Sublime Forum

file_regex Lookaround bug

#1

Hello.

I have buid tool error output lines like this.

D:\src\project\foo\tooo\file.cpp:11: error: expected constructor, destructor, or type conversion before ‘char’

I want to parse them via regex like this. for example

“file_regex”: “.+(?=(:[0-9]+:\s+error:))”

After building, when pressing F4 sublime selects
“D:\src\project\foo\tooo\file.cpp”

but it opens file than somewhy is named
“:11: error:”

Am I doing something wrong? Please say I’m not crasy :smile:

0 Likes

#2

Regex group 1,2 and 3 correspond to the filename, line and column respectively. Try something like “(.+):(\d+)”

0 Likes

#3

Wow. Didn’t know that!
Then what for is line_regex?

Where can this information be found? In any documentation I dind’t saw a word about groups.

Thank you.

P.S. “file_regex”: “(.+):(\d+): error: .*”
Worked fine.

0 Likes