Regular Expressions to match output.

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
rsgordon
Posts: 2
Joined: Mon Feb 23, 2004 3:15 pm

Regular Expressions to match output.

Post by rsgordon »

I have defined a tool to call our compiler but I am struggling to write an expression that will allow me to double click on an error in the output and take me to the file and line containing the error.

Our errors are output in the format :-

C:\TEMP\PROG1.CBL, line 238: Undefined data item: WSWROPN-LINKAGE1

What I need to extract is the file as PROG1.CBL (loosing the path) and the line number as 238.

Can anyone help me with the correct expression to add to the tool preferences.

Thanks,

Richard
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

This works for the single line you posted as a sample:
Regex ^.*\\(.+\....), line ([0-9]{1,5}): .*$
where the file name is \1 and the line number is \2, ie. registers are 1 and 2.
Note that I always look for a file ending of three letters, the (.+\....).

I use POSIX regular expression syntax, which can be selected from the
Editor page of the Preferences dialog box. HTH
Then I open up and see
the person fumbling here is me
a different way to be
rsgordon
Posts: 2
Joined: Mon Feb 23, 2004 3:15 pm

Post by rsgordon »

Thanks for the reply, it working great now.

Cheers,
Richard
Post Reply