The following is a simplified example of a RegEx replace that one of my customers is trying to perform.
Original text:
1 x
2 x
3 x
4 x
5 x
6 x
7 x
8 x
9 x
i.e. (space)#(space)x
Find Expression: \b+([^ ]+).+
Replace with: $1
The output is:
1
3
5
7
9
while it should be:
1
2
3
4
5
6
7
8
9
I tried the same expression in Visual Studio and it results in the correct output.
We tried various versions of the find expression, adding $ to the end or ^ to the start etc.
Even tried replacing the . with [\s\w] and specifically trying to catch the line end with [\r\n] to ensure that it did not 'match' the line end.
The only thing that worked was to change the \b+ to \s+ which works OK for the specific situation where the lines start with a space ... but in some cases they dont. (and using \s* at the start produces the same incorrect results as \b+.)
Could you please take a look at the RegEx engine you are using.
Thanks
Mike