| 1 |
// This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
// License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
// file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 |
|
| 5 |
js> var re = new RegExp("(?:<script.*?>)(.*)<\/script>") |
| 6 |
js> var t = 'foo <script>boo();</script>bar' |
| 7 |
js> var r = re.exec(t) |
| 8 |
js> if (r[1] != "boo();") { |
| 9 |
> throw "Bad result: " + r[1] |
| 10 |
> } else { |
| 11 |
> print("ok") |
| 12 |
> } |
| 13 |
ok |
| 14 |
js> var str = "<<xy"; |
| 15 |
js> var matches = str.match(/(?:<<)xy/); |
| 16 |
js> print(matches.join(", ")); |
| 17 |
<<xy |