Updating program header with current filename

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
scottbass
Posts: 17
Joined: Thu Nov 19, 2009 5:40 am
Location: Sydney, Australia

Updating program header with current filename

Post by scottbass »

Hi,

We have program headers in the following format:

Code: Select all

/*====================================================================
Study Number            : XXXX
Program Name            : xxxx
Purpose                 : Some comment about the program's purpose
SAS Version             : SAS 9.1.3
Input Data              : Some comment
Output Data             : More comment

Macros Called           : None

Originally Written by   : Scott Bass
Date                    : 11MAR2010
Program Version #       : 1.0
======================================================================

Modification History    : Original version

====================================================================*/
The edits I wish to accomplish are:

1) Replace "Study Number" with some static text
2) Replace "Program Name" with the current filename. Does $FileName work in regular expression like it does with Tools configuration?
3) Replace "Originally Written by" with some static text (the current programmer, who's cloned this code from someone else)
4) Replace "Date" with the current date

I'd like to restrict the edits to text between the first /* and next */ occurring in the file, in case "Program Name" or "Date" occur later in the file.

My main question is with #2 - is the current filename available to regular expressions as replacement text?

Finally, two more questions:

1) Helios, if you're listening, I know you keep your futures development list close to your chest - that's just how you choose to do your business. However, is an update to your Textpad regular expression engine in the current pipeline?

2) Does WildEdit use the same regular expression engine as Textpad? I realize the above may be better suited for WildEdit. But, if it uses the same engine as Textpad, it's unacceptable, and I'll just have to write a Perl script to accomplish this task.

Thanks,
Scott
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

No, the current filename is not available as a regex replacement value. It is available in TextPad as Edit, Insert, File Name but that's probably not as practical given that you have some perl-fu

2) WildEdit uses the Boost RegEx engine which is much more modern and powerful than the one currently in TP.
I choose to fight with a sack of angry cats.
Post Reply