Several regexes for one tool

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
slavav
Posts: 2
Joined: Wed Mar 05, 2008 10:11 pm

Several regexes for one tool

Post 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.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post 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.)
Last edited by Bob Hansen on Sun Dec 07, 2008 10:17 pm, edited 1 time in total.
Hope this was helpful.............good luck,
Bob
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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
slavav
Posts: 2
Joined: Wed Mar 05, 2008 10:11 pm

Post 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?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

^([^(:]+)[:(]([0-9]+)[:)]

Registers: File: 1, Line: 2.
Post Reply