OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview Check that an initial ^ will result in a faster match fail. |
| 7 */ |
| 8 |
| 9 import 'util.dart'; |
| 10 import 'package:expect/expect.dart'; |
| 11 |
| 12 void main() { |
| 13 var s = "foo"; |
| 14 var i; |
| 15 |
| 16 for (i = 0; i < 18; i++) { |
| 17 s = s + s; |
| 18 } |
| 19 |
| 20 dynamic repeatRegexp(re) { |
| 21 for (i = 0; i < 1000; i++) { |
| 22 re.hasMatch(s); |
| 23 } |
| 24 } |
| 25 |
| 26 repeatRegexp(new RegExp(r"^bar")); |
| 27 repeatRegexp(new RegExp(r"^foo|^bar|^baz")); |
| 28 repeatRegexp(new RegExp(r"(^bar)")); |
| 29 repeatRegexp(new RegExp(r"(?=^bar)\w+")); |
| 30 } |
OLD | NEW |