File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -127,17 +127,17 @@ if (isForced('RegExp', BASE_FORCED)) {
127
127
}
128
128
129
129
pattern = pattern === undefined ? '' : String ( pattern ) ;
130
- if ( pattern === '' ) pattern = '(?:)' ;
130
+ flags = flags === undefined ? '' : String ( flags ) ;
131
131
rawPattern = pattern ;
132
132
133
- if ( UNSUPPORTED_DOT_ALL ) {
133
+ if ( UNSUPPORTED_DOT_ALL && 'dotAll' in re1 ) {
134
134
dotAll = ! ! flags && flags . indexOf ( 's' ) > - 1 ;
135
135
if ( dotAll ) flags = flags . replace ( / s / g, '' ) ;
136
136
}
137
137
138
138
rawFlags = flags ;
139
139
140
- if ( UNSUPPORTED_Y ) {
140
+ if ( UNSUPPORTED_Y && 'sticky' in re1 ) {
141
141
sticky = ! ! flags && flags . indexOf ( 'y' ) > - 1 ;
142
142
if ( sticky ) flags = flags . replace ( / y / g, '' ) ;
143
143
}
@@ -166,7 +166,7 @@ if (isForced('RegExp', BASE_FORCED)) {
166
166
167
167
if ( pattern !== rawPattern ) try {
168
168
// fails in old engines, but we have no alternatives for unsupported regex syntax
169
- createNonEnumerableProperty ( result , 'source' , rawPattern ) ;
169
+ createNonEnumerableProperty ( result , 'source' , rawPattern === '' ? '(?:)' : rawPattern ) ;
170
170
} catch ( error ) { /* empty */ }
171
171
172
172
return result ;
You can’t perform that action at this time.
0 commit comments