Page 1 of 1

Several regexes for one tool

Posted: Sat Dec 06, 2008 11:12 pm
by slavav
Is there a chance to have several regular expressions and set of registers for one tool.

I often run projects compilation from TextPad tool menu. Compilation are made up from running different compilers and utilities. Different compilers use different formats of errors. Therefore, I can't use one regular expression to search for all possible errors of different formats. Current workaround is to pass compilation output through special filter utility, which converts all error formats to one common. It's very inconvenient. Several regular expressions could allow me to avoid such filter.

Thank you in advance.

Posted: Sun Dec 07, 2008 3:04 am
by Bob Hansen
Be sure to try the pipe symbol "|" for "OR" in your Regex searches

Search for abc|xyz|rst|123


(I edited above to change from IF to OR, thanks to ben_josephs for pointing it out.)

Posted: Sun Dec 07, 2008 7:24 pm
by ben_josephs
Bob's syntax for alternation ("or" -- he meant "or", not "if") assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax

Posted: Tue Dec 16, 2008 10:31 pm
by slavav
This is my attempt:

compilation listing is:

error.cpp:3: error: `error' undeclared (first use this function)
error.cpp:3: error: (Each undeclared identifier is reported only once for each function it appears in.)
error.cpp:3: error: expected `;' before '}' token
error.cpp
error.cpp(3) : error C2065: 'error' : undeclared identifier
error.cpp(3) : error C2143: syntax error : missing ';' before '}'

Regular expression is:

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

(I am using POSIX regular expression syntax).

Registers: File: 1 Line: 2:

First, second and third errors match with expression but Textpad complains about incorrect path.
Fourth and fifth errors match with expression and open corresponding file and line.

If I change registers to File: 2 Line: 3:

First, second and third errors match with expression and open corresponding file and line.
Fourth and fifth errors match with expresion but Textpad complains "file not found".

As far as I know it is impossible to tune registers for this expression.
Is something wrong with expression?
How should I change the expression to make TextPad happy with all errors in listing?

Posted: Tue Dec 16, 2008 10:53 pm
by ben_josephs
^([^(:]+)[:(]([0-9]+)[:)]

Registers: File: 1, Line: 2.