156ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// Copyright 2012 the V8 project authors. All rights reserved.
256ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// Redistribution and use in source and binary forms, with or without
356ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// modification, are permitted provided that the following conditions are
456ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// met:
556ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//
656ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//     * Redistributions of source code must retain the above copyright
756ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//       notice, this list of conditions and the following disclaimer.
856ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//     * Redistributions in binary form must reproduce the above
956ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//       copyright notice, this list of conditions and the following
1056ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//       disclaimer in the documentation and/or other materials provided
1156ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//       with the distribution.
1256ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//     * Neither the name of Google Inc. nor the names of its
1356ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//       contributors may be used to endorse or promote products derived
1456ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//       from this software without specific prior written permission.
1556ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson//
1656ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1756ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1856ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1956ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2056ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2156ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2256ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2356ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2456ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2556ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2656ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2756ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson
2856ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodsonvar string = "What are you looking for?";
2956ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson
3056ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodsonvar expected_match = [""];
3156ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodsonfor (var i = 0; i < string.length; i++) {
3256ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson  expected_match.push("");
3356ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson}
3456ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson
3556ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodsonstring.replace(/(_)|(_|)/g, "");
3656ed4167b942ec265f9cee70ac4d71d10b3835ceBen DodsonassertArrayEquals(expected_match, string.match(/(_)|(_|)/g, ""));
3756ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson
3856ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson'***************************************'.match(/((\\)|(\*)|(\$))/g, ".");
3956ed4167b942ec265f9cee70ac4d71d10b3835ceBen Dodson