Page 1 of 1

Updating program header with current filename

Posted: Tue Mar 16, 2010 10:28 pm
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

Posted: Wed Mar 17, 2010 3:48 pm
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.