Page 1 of 1

RegExp

Posted: Sun Sep 02, 2001 1:45 pm
by Nigel Warner
Hi there,

I am having a problem with TextPad 4.5 and regular expressions.

I have output in the command window of the form:

Warning keyword.c 1000: Condition is always false in function do_rewind
Error keyword.c 1113: Nonportable pointer conversion in function set_wrap

I am attempting to jump to the offending lines using the tools regexp

^\(Error\|Warning\) \(.+\) \([0-9]+\):

with the file and line set to 2 and 3 respectivly. However this does not work.
Am I missing something ?

I have also tried cutting some messages to another window and attempting
a regular expression search of the form \(Error\) . This does not work either.
Can anyone shed some light on this ?

Regards,

Nigel

Re: RegExp

Posted: Mon Sep 03, 2001 6:36 am
by Jens Hollmann
I think that is because .+ is a "greedy" expression and will match everything from "keyword.c..." to "...in function". "." matches a space too!

So better try something like

\(Warning\|Error\) \([[:graph:]]+\) \([[:digit:]]+\):

because [:graph:] does not match a space.