Page 1 of 1

Regular expression help

Posted: Wed Feb 06, 2002 6:04 pm
by Brian Jackson
Hi,

I'm hoping that someone will have a suggestion for me because I've been working with the regular expressions descriptions over and over, and I can't figure out how to make double-click "jump-to's" work in the command results window with my compiler.

My compiler generates messages like this:

...
148. INCLUDE T: qryrailcarstatcentrespa00.inc
149. INCLUDE U: qryrailcarstatloclrespa00.inc
150. INCLUDE V: qryrailcarvinrespa00.inc
151. INCLUDE W: qrytrkrespa00.inc
152. INCLUDE X: qryvinramposrespa00.inc
153. INCLUDE Y: qryvinreqbayrespa00.inc
154. INCLUDE Z: sbmtadhocrespa00.inc
155. INCLUDE AA: sbmtasnrespa00.inc
156. INCLUDE AB: sbmtvingateactrespa00.inc
...

There are two things going on here. First of all, most of the lines just refer to include files. I'd like to be able to double-click on the file names and open those files. Thus far, I've not been able to figure out how to write a regular expression to do this. Can anyone be of any help with this?

Thanks in advance,
Brian

Re: Regular expression help

Posted: Wed Feb 06, 2002 7:30 pm
by Ed Orchard
Assuming the qryrailcarstatcentrespa00.inc etc are filenames in the current directory and that the error line always starts with a number and has ": " before the filename then the following reg expression should work with "File:" set to 1

^[0-9]+. [^:]+: \([.[:alnum:]]+\)

...or have I missed the point?

Re: Regular expression help

Posted: Wed Feb 06, 2002 8:05 pm
by Brian Jackson
Ed,

Thank you very much. The expression ^[0-9]+. [^:]+: \([.[:alnum:]]+\) was almost exactly what I needed. Since there may be leading spaces in the numeric string, I changed the ^[0-9] part of the expression to ^.*[0-9], and since underscore and other such characters may appear in the filenames, I changed [:alnum:] to [:print:]. The resulting expression is:

^.*[0-9]+. [^:]+: \([.[:print:]]+\)

Everything is working just as it should now. Thank you very much for your help.

Brian

Re: Regular expression help

Posted: Mon Feb 11, 2002 2:03 pm
by Carlyle Sutphen
Hi, Brian,

to take care of leading spaces, it would be more correct to use:

^[ ]*[0-9]+. [^:]+: \([.[:print:]]+\)

since the period matches anything including the numbers.

Carlyle