L
Liviu Uba
Hi,
I noticed a strange behaviour, strange from my point of view anyway.
Let's say I have the regex expression: "^\w+".
When I do:
Let's say s = "first second";
Regex r = new Regex( "^\w+", RegexOptions.CaseInsensitive...);
Match m = r.Match(s) ; // here we have m.Succes = true;
m = r.Match(s,6); //here we have m.Success = false;
I would have expected that the ^ will match the beginning of the actual
text queried, but that is not the case.
The fact that ^ does not match this type of call, is possible to work around
but it means a serious performance problem: to match the expression without
^ and to verify that the first match starts from 0, or to copy the string
from the position I query which is not an option for a huge string.
Has anyone got a clue how to make ^ working?
I noticed a strange behaviour, strange from my point of view anyway.
Let's say I have the regex expression: "^\w+".
When I do:
Let's say s = "first second";
Regex r = new Regex( "^\w+", RegexOptions.CaseInsensitive...);
Match m = r.Match(s) ; // here we have m.Succes = true;
m = r.Match(s,6); //here we have m.Success = false;
I would have expected that the ^ will match the beginning of the actual
text queried, but that is not the case.
The fact that ^ does not match this type of call, is possible to work around
but it means a serious performance problem: to match the expression without
^ and to verify that the first match starts from 0, or to copy the string
from the position I query which is not an option for a huge string.
Has anyone got a clue how to make ^ working?