Using regex named subexpresion g_match_info_fetch_named returns incorrect result.
Submitted by Geronimo Bareiro
Link to original bug (#773285)
Description
Created attachment 338110 a test mock up
I'm using Arch Linux x64
vala 0.32.1 (0.32.1-1 arch package)
gtk+3 3.20.9 (3.20.9-1 arch package)
glib 2.48.2 (2.48.2-1 arch package)
Problem:
The next regex
"line (?`<line>`\\d+) column (?`<col>`\\d+) - ((?`<err>`Error)|(?`<war>`Warning)): (?`<message>`.*)"
Used against the text expression:
line 1 column 2 - Error: lalala
line 96 column 81 - Warning: inserting implicit `<p>`
line 134 column 1 - Warning: inserting implicit `<p>`
line 148 column 69 - Warning: replacing unexpected font with `</font>`
line 151 column 67 - Warning: replacing unexpected em with `</em>`
line 162 column 7 - Warning: inserting implicit `<p>`
line 162 column 11 - Warning: inserting implicit `<p>`
line 170 column 1 - Warning: inserting implicit `<p>`
gives the wrong result.
When I try to get
match.fetch_named("line")
and match.fetch_named("col")
return a wrong result for the first line, but success for the next lines but if I make sure that the string has more than 11 characters (10+ the new line) before the first "line" it succeeds.
In the attached file the relevant code is in the function on_run_clicked after the line 122.
Steps to reproduce the issue:
Compile the file using vala.
- Click run.
- Click select input
- Change between inpu1/input2
- click Run.
- In the results widget the line/column will show "0 0" or "1 2" respectively.
Attachment 338110, "a test mock up":
example14.vala
Version: 2.48.x