projects
/
platform
/
upstream
/
dotnet
/
runtime.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
95a984b
)
Parse [^] when ecmascript is set
author
Prashanth Govindarajan
<prgovi@microsoft.com>
Tue, 17 Dec 2019 21:15:27 +0000
(13:15 -0800)
committer
Prashanth Govindarajan
<prgovi@microsoft.com>
Tue, 17 Dec 2019 21:15:27 +0000
(13:15 -0800)
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs
patch
|
blob
|
history
src/libraries/System.Text.RegularExpressions/tests/Regex.MultipleMatches.Tests.cs
patch
|
blob
|
history
src/libraries/System.Text.RegularExpressions/tests/RegexParserTests.cs
patch
|
blob
|
history
diff --git
a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs
b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs
index
4f3ae32
..
edfe8bc
100644
(file)
--- a/
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs
+++ b/
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs
@@
-562,6
+562,10
@@
namespace System.Text.RegularExpressions
{
charClass!.Negate = true;
}
+ if ((_options & RegexOptions.ECMAScript) != 0 && CharAt(_currentPos) == ']')
+ {
+ firstChar = false;
+ }
}
for (; CharsRight() > 0; firstChar = false)
diff --git
a/src/libraries/System.Text.RegularExpressions/tests/Regex.MultipleMatches.Tests.cs
b/src/libraries/System.Text.RegularExpressions/tests/Regex.MultipleMatches.Tests.cs
index
da03141
..
321ffe5
100644
(file)
--- a/
src/libraries/System.Text.RegularExpressions/tests/Regex.MultipleMatches.Tests.cs
+++ b/
src/libraries/System.Text.RegularExpressions/tests/Regex.MultipleMatches.Tests.cs
@@
-140,6
+140,19
@@
namespace System.Text.RegularExpressions.Tests
new CaptureData("C789", 10, 4),
}
};
+
+ yield return new object[]
+ {
+ "[^]", "every", RegexOptions.ECMAScript,
+ new CaptureData[]
+ {
+ new CaptureData("e", 0, 1),
+ new CaptureData("v", 1, 1),
+ new CaptureData("e", 2, 1),
+ new CaptureData("r", 3, 1),
+ new CaptureData("y", 4, 1),
+ }
+ };
}
[Theory]
diff --git
a/src/libraries/System.Text.RegularExpressions/tests/RegexParserTests.cs
b/src/libraries/System.Text.RegularExpressions/tests/RegexParserTests.cs
index
a0d4e0d
..
aa108fd
100644
(file)
--- a/
src/libraries/System.Text.RegularExpressions/tests/RegexParserTests.cs
+++ b/
src/libraries/System.Text.RegularExpressions/tests/RegexParserTests.cs
@@
-882,13
+882,5
@@
namespace System.Text.RegularExpressions.Tests
throw new XunitException($"Expected RegexParseException with error: ({error}) -> Actual: No exception thrown");
}
-
- [Fact]
- public void TestPattern()
- {
- Debugger.Launch();
- string pattern = @"[b-\-a]";
- var regex = new Regex(pattern);
- }
}
}