Regex to match PHP output

General questions about using TextPad

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

Post Reply
kAlvaro
Posts: 17
Joined: Mon Apr 28, 2003 7:46 am
Contact:

Regex to match PHP output

Post by kAlvaro »

I've created a tool to launch PHP scripts (command line interface). Now I'm trying to add a regex (POSIX syntax) so I can double click on errors and jump to the offending line. Errors look like this:

Code: Select all

Parse error: parse error, unexpected T_STRING in C:\tmp\borrame.php on line 31
Warning: Wrong parameter count for mysql_query() in C:\tmp\borrame.php on line 60
My first attemp was:

Code: Select all

 in (.*) on line ([0-9]+)$
I then tried:

Code: Select all

.*([0-9]+)$
... and many other variations... I've tried to escape parenthesis... I've tried everything... to no avail. I always get a "cannot jump to element under cursor" error message. What vital point am I missing?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

It seems to attempt a match only at the beginning of the line. Try
.* in (.*) on line ([0-9]+)$
kAlvaro
Posts: 17
Joined: Mon Apr 28, 2003 7:46 am
Contact:

Post by kAlvaro »

You're right, it seems the key is that the expression must match the beginning of the line (a sort of implicit ^). Your regex works fine. Actually, even the second of my examples works fine today. Damn computer goblins.
Post Reply