File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/libraries/System.Text.RegularExpressions/tests/FunctionalTests Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1431,11 +1431,20 @@ public async Task PatternsDataSet_ConstructRegexForAll_NonBacktracking()
14311431 {
14321432 foreach ( DataSetExpression exp in s_patternsDataSet . Value )
14331433 {
1434+ if ( ( exp . Options & ( RegexOptions . ECMAScript | RegexOptions . RightToLeft ) ) != 0 )
1435+ {
1436+ // Unsupported options with NonBacktracking
1437+ continue ;
1438+ }
1439+
14341440 try
14351441 {
14361442 await RegexHelpers . GetRegexAsync ( RegexEngine . NonBacktracking , exp . Pattern , exp . Options ) ;
14371443 }
1438- catch ( Exception e ) when ( e . Message . Contains ( nameof ( RegexOptions . NonBacktracking ) ) ) { }
1444+ catch ( NotSupportedException e ) when ( e . Message . Contains ( nameof ( RegexOptions . NonBacktracking ) ) )
1445+ {
1446+ // Unsupported patterns
1447+ }
14391448 }
14401449 }
14411450
You can’t perform that action at this time.
0 commit comments