(regex, opt)
| 1246 | } |
| 1247 | |
| 1248 | function replace(regex, opt) { |
| 1249 | regex = regex.source; |
| 1250 | opt = opt || ''; |
| 1251 | return function self(name, val) { |
| 1252 | if (!name) return new RegExp(regex, opt); |
| 1253 | val = val.source || val; |
| 1254 | val = val.replace(/(^|[^\[])\^/g, '$1'); |
| 1255 | regex = regex.replace(name, val); |
| 1256 | return self; |
| 1257 | }; |
| 1258 | } |
| 1259 | |
| 1260 | function noop() {} |
| 1261 | noop.exec = noop; |