(regex, opt)
| 985 | } |
| 986 | |
| 987 | function replace(regex, opt) { |
| 988 | regex = regex.source; |
| 989 | opt = opt || ''; |
| 990 | return function self(name, val) { |
| 991 | if (!name) return new RegExp(regex, opt); |
| 992 | val = val.source || val; |
| 993 | val = val.replace(/(^|[^\[])\^/g, '$1'); |
| 994 | regex = regex.replace(name, val); |
| 995 | return self; |
| 996 | }; |
| 997 | } |
| 998 | |
| 999 | function noop() {} |
| 1000 | noop.exec = noop; |