On 19/07/2012 09:30, Lex Trotman wrote:
On 19 July 2012 17:38, Laszlo Nagygandalf@shopzeus.com wrote:
Here is an example. There are two kinds of error messages that I can get - because there can be an error in the compiler that I'm working on, and also there can be an error in the file that is being compiled:
Error message (type one):
File "/home/gandalf/Python/Lib/shopzeus/scripts/ssdlc.py", line 23, in
<module>
Regexp (type one):
\s*File\s"([^"]+)", line (\d+), in\s*(.*)
Error message (type two):
/home/gandalf/Python/Lib/shopzeus/demos/ssdl/test/test.ssdl:53:9:Syntax error
Regexp (type two):
([^:]+):([^:]+):[^:]+:([^:]+)
Both of these errors can happen then I press F8, so I would like to capture both messages if possible. This is what I have tried:
(?:\s*File\s"([^"]+)", line (\d+), in\s*(.*))|(?:([^:]+):([^:]+):[^:]+:([^:]+))
But it does not capture errors in the compiler. Maybe my regular expression is wrong. Or maybe the non-capturing group "?:" does not work.
I couldn't find the problem with that regex exactly, but it seems to be the [^"]+ part.
This seems to work here: File\s(\S+?), line (\d+)|(\S+):(\S+):
It might need tweaking though. The regex doesn't have to match the entire line.
Also, the 2nd regex seems to be unnecessary as Geany already tries this pattern as a built in.
IIUC Match group numbering is in the order they occur in the regex, not the order they match, so the "type two" regex groups are 3 and 4 which geany ignores. The method isn't really suited to mixed
No, the type two matches start from 1.
Nick