peck797
Tomato Guru
United Kingdom
171 Posts |
Posted - Feb 17 2012 : 11:40:44 AM
|
Unfortunately, I can't reproduce this behaviour all the time but I have found one particular regex string where it seems to be reproducible and repeatable on my PC.
I have the following definition:
regex_ = new Regex( @"^\\s*\\[\\s*" + @"(?<longHem>(?:N(?:orth)?)|(?:S(?:outh)?))\\s*\\.\\s*" + @"(?<longDeg>(?:\\+|\\-)?\\d+)\\s*\\.\\s*" + @"(?<longMin>\\d+)\\s*\\.\\s*" + @"(?<longSec>\\d+(?:.\\d*)?)\\s*,\\s*" + @"(?<latHem>(?:E(?:ast)?)|(?:W(?:est)?))\\s*\\.\\s*" + @"(?<latDeg>(?:\\+|\\-)?\\d+)\\s*\\.\\s*" + @"(?<latMin>\\d+)\\s*\\.\\s*" + @"(?<latSec>\\d+(?:.\\d*)?)\\s*" + @"(?:,\\s*(?<alt>(?:\\+|\\-)?\\d+(?:.\\d*)?))?\\s*" + @"\\]\\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
If I put the caret before some of the ')' characters in part of that expression and hit the ')' key on my keyboard, then VAX "absorbs" the ')' and jumps over it. This is despite the fact that, IMO, it's a string and shouldn't be being parsed but it even happens if there is, in fact, a missing ')' somewhere in the expression (which is why I hit the problem in practice!)
For example, try putting the caret before the final ')' in the penultimate string part:
+ @"(?:,\\s*(?<alt>(?:\\+|\\-)?\\d+(?:.\\d*)?))?\\s*"
and hit the ')' key. For me, it jumps over that character rather than adding a new one. It will do this even if you delete one of the earlier '(' characters on the same line.
If you can't reproduce it, then I'll go back to sleep; it's not life threatening but I seem to have found one case where this occasional glitch is 100% repeatable for me!
Dan
|
|