How to use regExp method in wpt

Best JavaScript code snippet using wpt

non-pattern-characters.js

Source:non-pattern-characters.js Github

copy

Full Screen

1description(2"This page tests handling of characters which, according to ECMA 262, are not regular expression PatternCharacters. Those characters are: ^ $ \ . * + ? ( ) [ ] { } |"3);4// We test two cases, to match the two cases in the WREC parser.5// Test 1: the character stand-alone.6// Test 2: the character following a PatternCharacter.7var regexp;8// ^: Always allowed, always an assertion.9regexp = /^/g;10debug("\nTesting regexp: " + regexp);11shouldBeTrue("regexp.test('')");12shouldBe("regexp.lastIndex", "0");13regexp = /\n^/gm;14debug("\nTesting regexp: " + regexp);15shouldBeTrue("regexp.test('\\n\\n')");16shouldBe("regexp.lastIndex", "1");17// $: Always allowed, always an assertion.18regexp = /$/g;19debug("\nTesting regexp: " + regexp);20shouldBeTrue("regexp.test('')");21shouldBe("regexp.lastIndex", "0");22regexp = /\n$/gm;23debug("\nTesting regexp: " + regexp);24shouldBeTrue("regexp.test('\\n\\n')");25shouldBe("regexp.lastIndex", "1");26// \: Only allowed as a prefix. Contrary to spec, always treated as an27// IdentityEscape when followed by an invalid escape postfix.28regexp = /\z/;29debug("\nTesting regexp: " + regexp);30shouldBeTrue("regexp.test('z')"); // invalid postfix => IdentityEscape31regexp = /a\z/;32debug("\nTesting regexp: " + regexp);33shouldBeTrue("regexp.test('az')"); // invalid postfix => IdentityEscape34regexp = /\_/;35debug("\nTesting regexp: " + regexp);36shouldBeTrue("regexp.test('_')"); // invalid postfix => IdentityEscape37regexp = /a\_/;38debug("\nTesting regexp: " + regexp);39shouldBeTrue("regexp.test('a_')"); // invalid postfix => IdentityEscape40debug("\nTesting regexp: " + "[invalid \\ variations]");41shouldThrow("/\\/"); // no postfix => not allowed42shouldThrow("/a\\/"); // no postfix => not allowed43// .: Always allowed, always a non-newline wildcard.44regexp = /./;45debug("\nTesting regexp: " + regexp);46shouldBeTrue("regexp.test('a')");47shouldBeFalse("regexp.test('\\n')");48regexp = /a./;49debug("\nTesting regexp: " + regexp);50shouldBeTrue("regexp.test('aa')");51shouldBeFalse("regexp.test('a\\n')");52// *: Only allowed as a postfix to a PatternCharacter. Behaves as a {0,Infinity} quantifier.53regexp = /a*/gm;54debug("\nTesting regexp: " + regexp);55shouldBeTrue("regexp.test('b')");56shouldBe("regexp.lastIndex", "0");57shouldBeTrue("regexp.test('aaba')");58shouldBe("regexp.lastIndex", "2");59debug("\nTesting regexp: " + "[invalid * variations]");60shouldThrow("/*/"); // Unterminated comment.61shouldThrow("/^*/"); // Prefixed by ^ to avoid confusion with comment syntax.62// +: Only allowed as a postfix to a PatternCharacter. Behaves as a {1,Infinity} quantifier.63regexp = /a+/gm;64debug("\nTesting regexp: " + regexp);65shouldBeFalse("regexp.test('b')");66shouldBeTrue("regexp.test('aaba')");67shouldBe("regexp.lastIndex", "2");68debug("\nTesting regexp: " + "[invalid + variations]");69shouldThrow("/+/");70// ?: Only allowed as a postfix to a PatternCharacter. Behaves as a {0,1} quantifier.71regexp = /a?/gm;72debug("\nTesting regexp: " + regexp);73shouldBeTrue("regexp.test('b')");74shouldBe("regexp.lastIndex", "0");75shouldBeTrue("regexp.test('aaba')");76shouldBe("regexp.lastIndex", "1");77debug("\nTesting regexp: " + "[invalid ? variations]");78shouldThrow("/?/");79// (: Only allowed if it matches a ).80debug("\nTesting regexp: " + "[invalid ( variations]");81shouldThrow("/(/");82shouldThrow("/a(/");83// ): Only allowed if it matches a (.84debug("\nTesting regexp: " + "[invalid ) variations]");85shouldThrow("/)/");86shouldThrow("/a)/");87// [: Only allowed if it matches a ] and the stuff in between is a valid character class.88debug("\nTesting regexp: " + "[invalid [ variations]");89shouldThrow("/[/");90shouldThrow("/a[/");91shouldThrow("/[b-a]/");92shouldThrow("/a[b-a]/");93// ]: Closes a ]. Contrary to spec, if no [ was seen, acts as a regular PatternCharacter.94regexp = /]/gm;95debug("\nTesting regexp: " + regexp);96shouldBeTrue("regexp.test(']')");97shouldBe("regexp.lastIndex", "1");98regexp = /a]/gm;99debug("\nTesting regexp: " + regexp);100shouldBeTrue("regexp.test('a]')");101shouldBe("regexp.lastIndex", "2");102// {: Begins a quantifier. Contrary to spec, if no } is seen, or if the stuff in103// between does not lex as a quantifier, acts as a regular PatternCharacter. If104// the stuff in between does lex as a quantifier, but the quantifier is invalid,105// acts as a syntax error.106regexp = /{/gm;107debug("\nTesting regexp: " + regexp);108shouldBeTrue("regexp.test('{')");109shouldBe("regexp.lastIndex", "1");110regexp = /a{/gm;111debug("\nTesting regexp: " + regexp);112shouldBeTrue("regexp.test('a{')");113shouldBe("regexp.lastIndex", "2");114regexp = /{a/gm;115debug("\nTesting regexp: " + regexp);116shouldBeTrue("regexp.test('{a')");117shouldBe("regexp.lastIndex", "2");118regexp = /a{a/gm;119debug("\nTesting regexp: " + regexp);120shouldBeTrue("regexp.test('a{a')");121shouldBe("regexp.lastIndex", "3");122regexp = /{1,/gm;123debug("\nTesting regexp: " + regexp);124shouldBeTrue("regexp.test('{1,')");125shouldBe("regexp.lastIndex", "3");126regexp = /a{1,/gm;127debug("\nTesting regexp: " + regexp);128shouldBeTrue("regexp.test('a{1,')");129shouldBe("regexp.lastIndex", "4");130regexp = /{1,a/gm;131debug("\nTesting regexp: " + regexp);132shouldBeTrue("regexp.test('{1,a')");133shouldBe("regexp.lastIndex", "4");134regexp = /{1,0/gm;135debug("\nTesting regexp: " + regexp);136shouldBeTrue("regexp.test('{1,0')");137shouldBe("regexp.lastIndex", "4");138regexp = /{1, 0}/gm;139debug("\nTesting regexp: " + regexp);140shouldBeTrue("regexp.test('{1, 0}')");141shouldBe("regexp.lastIndex", "6");142regexp = /a{1, 0}/gm;143debug("\nTesting regexp: " + regexp);144shouldBeTrue("regexp.test('a{1, 0}')");145shouldBe("regexp.lastIndex", "7");146try { regexp = new RegExp("a{1,0", "gm"); } catch(e) { regexp = e; }; // Work around exception thrown in Firefox -- probably too weird to be worth matching. 147debug("\nTesting regexp: " + regexp);148shouldBeTrue("regexp.test('a{1,0')");149shouldBe("regexp.lastIndex", "5");150regexp = /a{0}/gm;151debug("\nTesting regexp: " + regexp);152shouldBeTrue("regexp.test('a')");153shouldBe("regexp.lastIndex", "0");154shouldBeTrue("regexp.test('b')");155shouldBe("regexp.lastIndex", "0");156debug("\nTesting regexp: " + "[invalid {} variations]");157shouldThrow("/{0}/");158shouldThrow("/{1,0}/");159shouldThrow("/a{1,0}/");160// }: Ends a quantifier. Same rules as for {.161regexp = /}/gm;162debug("\nTesting regexp: " + regexp);163shouldBeTrue("regexp.test('}')");164shouldBe("regexp.lastIndex", "1");165regexp = /a}/gm;166debug("\nTesting regexp: " + regexp);167shouldBeTrue("regexp.test('a}')");168shouldBe("regexp.lastIndex", "2");169// |: Always allowed, always separates two alternatives.170regexp = new RegExp("", "gm");171debug("\nTesting regexp: " + regexp);172shouldBeTrue("regexp.test('')");173shouldBe("regexp.lastIndex", "0");174regexp = /|/gm;175debug("\nTesting regexp: " + regexp);176shouldBeTrue("regexp.test('|')");177shouldBe("regexp.lastIndex", "0");178regexp = /a|/gm;179debug("\nTesting regexp: " + regexp);180shouldBeTrue("regexp.test('|')");...

Full Screen

Full Screen

RegExp_dollar_number.js

Source:RegExp_dollar_number.js Github

copy

Full Screen

1/* The contents of this file are subject to the Netscape Public2 * License Version 1.1 (the "License"); you may not use this file3 * except in compliance with the License. You may obtain a copy of4 * the License at http://www.mozilla.org/NPL/5 *6 * Software distributed under the License is distributed on an "AS7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or8 * implied. See the License for the specific language governing9 * rights and limitations under the License.10 *11 * The Original Code is Mozilla Communicator client code, released March12 * 31, 1998.13 *14 * The Initial Developer of the Original Code is Netscape Communications15 * Corporation. Portions created by Netscape are16 * Copyright (C) 1998 Netscape Communications Corporation. All17 * Rights Reserved.18 *19 * Contributor(s): 20 * 21 */22/**23 Filename: RegExp_dollar_number.js24 Description: 'Tests RegExps $1, ..., $9 properties'2526 Author: Nick Lerissa27 Date: March 12, 199828*/2930 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';31 var VERSION = 'no version';32 startTest();33 var TITLE = 'RegExp: $1, ..., $9';34 var BUGNUMBER="123802";3536 writeHeaderToLog('Executing script: RegExp_dollar_number.js');37 writeHeaderToLog( SECTION + " "+ TITLE);3839 var count = 0;40 var testcases = new Array();4142 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$143 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/);44 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1",45 'abcdefghi', RegExp.$1);4647 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$248 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2",49 'bcdefgh', RegExp.$2);5051 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$352 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3",53 'cdefg', RegExp.$3);5455 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$456 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4",57 'def', RegExp.$4);5859 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$560 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5",61 'e', RegExp.$5);6263 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$664 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6",65 '', RegExp.$6);6667 var a_to_z = 'abcdefghijklmnopqrstuvwxyz';68 var regexp1 = /(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/69 // 'abcdefghijklmnopqrstuvwxyz'.match(/(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/); RegExp.$170 a_to_z.match(regexp1);7172 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1",73 'a', RegExp.$1);74 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2",75 'c', RegExp.$2);76 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3",77 'e', RegExp.$3);78 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4",79 'g', RegExp.$4);80 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5",81 'i', RegExp.$5);82 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6",83 'k', RegExp.$6);84 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7",85 'm', RegExp.$7);86 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8",87 'o', RegExp.$8);88 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9",89 'q', RegExp.$9);90/*91 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10",92 's', RegExp.$10);93*/94 function test()95 {96 for ( tc=0; tc < testcases.length; tc++ ) {97 testcases[tc].passed = writeTestCaseResult(98 testcases[tc].expect,99 testcases[tc].actual,100 testcases[tc].description +" = "+101 testcases[tc].actual );102 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";103 }104 stopTest();105 return ( testcases );106 }107 ...

Full Screen

Full Screen

unicode_restricted_octal_escape.js

Source:unicode_restricted_octal_escape.js Github

copy

Full Screen

1// Copyright (C) 2015 André Bargull. All rights reserved.2// This code is governed by the BSD license found in the LICENSE file.3/*---4description: B.1.4 is not applied for Unicode RegExp - Octal escape sequences5info: >6 The compatibility extensions defined in B.1.4 Regular Expressions Patterns7 are not applied for Unicode RegExp.8 Tested extension: "CharacterEscape[U] :: [~U] LegacyOctalEscapeSequence"9es6id: 21.1.210---*/11// DecimalEscape without leading 0 in AtomEscape.12//13// AtomEscape[U] :: DecimalEscape14// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]15assert.throws(SyntaxError, function() {16 RegExp("\\1", "u");17}, 'RegExp("\\1", "u"): ');18assert.throws(SyntaxError, function() {19 RegExp("\\2", "u");20}, 'RegExp("\\2", "u"): ');21assert.throws(SyntaxError, function() {22 RegExp("\\3", "u");23}, 'RegExp("\\3", "u"): ');24assert.throws(SyntaxError, function() {25 RegExp("\\4", "u");26}, 'RegExp("\\4", "u"): ');27assert.throws(SyntaxError, function() {28 RegExp("\\5", "u");29}, 'RegExp("\\5", "u"): ');30assert.throws(SyntaxError, function() {31 RegExp("\\6", "u");32}, 'RegExp("\\6", "u"): ');33assert.throws(SyntaxError, function() {34 RegExp("\\7", "u");35}, 'RegExp("\\7", "u"): ');36assert.throws(SyntaxError, function() {37 RegExp("\\8", "u");38}, 'RegExp("\\8", "u"): ');39assert.throws(SyntaxError, function() {40 RegExp("\\9", "u");41}, 'RegExp("\\9", "u"): ');42// DecimalEscape without leading 0 in ClassEscape.43//44// ClassEscape[U] :: DecimalEscape45// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]46assert.throws(SyntaxError, function() {47 RegExp("[\\1]", "u");48}, 'RegExp("[\\1]", "u"): ');49assert.throws(SyntaxError, function() {50 RegExp("[\\2]", "u");51}, 'RegExp("[\\2]", "u"): ');52assert.throws(SyntaxError, function() {53 RegExp("[\\3]", "u");54}, 'RegExp("[\\3]", "u"): ');55assert.throws(SyntaxError, function() {56 RegExp("[\\4]", "u");57}, 'RegExp("[\\4]", "u"): ');58assert.throws(SyntaxError, function() {59 RegExp("[\\5]", "u");60}, 'RegExp("[\\5]", "u"): ');61assert.throws(SyntaxError, function() {62 RegExp("[\\6]", "u");63}, 'RegExp("[\\6]", "u"): ');64assert.throws(SyntaxError, function() {65 RegExp("[\\7]", "u");66}, 'RegExp("[\\7]", "u"): ');67assert.throws(SyntaxError, function() {68 RegExp("[\\8]", "u");69}, 'RegExp("[\\8]", "u"): ');70assert.throws(SyntaxError, function() {71 RegExp("[\\9]", "u");72}, 'RegExp("[\\9]", "u"): ');73// DecimalEscape with leading 0 in AtomEscape.74//75// Atom[U] :: DecimalEscape76// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]77assert.throws(SyntaxError, function() {78 RegExp("\\00", "u");79}, 'RegExp("\\00", "u"): ');80assert.throws(SyntaxError, function() {81 RegExp("\\01", "u");82}, 'RegExp("\\01", "u"): ');83assert.throws(SyntaxError, function() {84 RegExp("\\02", "u");85}, 'RegExp("\\02", "u"): ');86assert.throws(SyntaxError, function() {87 RegExp("\\03", "u");88}, 'RegExp("\\03", "u"): ');89assert.throws(SyntaxError, function() {90 RegExp("\\04", "u");91}, 'RegExp("\\04", "u"): ');92assert.throws(SyntaxError, function() {93 RegExp("\\05", "u");94}, 'RegExp("\\05", "u"): ');95assert.throws(SyntaxError, function() {96 RegExp("\\06", "u");97}, 'RegExp("\\06", "u"): ');98assert.throws(SyntaxError, function() {99 RegExp("\\07", "u");100}, 'RegExp("\\07", "u"): ');101assert.throws(SyntaxError, function() {102 RegExp("\\08", "u");103}, 'RegExp("\\08", "u"): ');104assert.throws(SyntaxError, function() {105 RegExp("\\09", "u");106}, 'RegExp("\\09", "u"): ');107// DecimalEscape with leading 0 in ClassEscape.108//109// ClassEscape[U] :: DecimalEscape110// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]111assert.throws(SyntaxError, function() {112 RegExp("[\\00]", "u");113}, 'RegExp("[\\00]", "u"): ');114assert.throws(SyntaxError, function() {115 RegExp("[\\01]", "u");116}, 'RegExp("[\\01]", "u"): ');117assert.throws(SyntaxError, function() {118 RegExp("[\\02]", "u");119}, 'RegExp("[\\02]", "u"): ');120assert.throws(SyntaxError, function() {121 RegExp("[\\03]", "u");122}, 'RegExp("[\\03]", "u"): ');123assert.throws(SyntaxError, function() {124 RegExp("[\\04]", "u");125}, 'RegExp("[\\04]", "u"): ');126assert.throws(SyntaxError, function() {127 RegExp("[\\05]", "u");128}, 'RegExp("[\\05]", "u"): ');129assert.throws(SyntaxError, function() {130 RegExp("[\\06]", "u");131}, 'RegExp("[\\06]", "u"): ');132assert.throws(SyntaxError, function() {133 RegExp("[\\07]", "u");134}, 'RegExp("[\\07]", "u"): ');135assert.throws(SyntaxError, function() {136 RegExp("[\\08]", "u");137}, 'RegExp("[\\08]", "u"): ');138assert.throws(SyntaxError, function() {139 RegExp("[\\09]", "u");140}, 'RegExp("[\\09]", "u"): ');...

Full Screen

Full Screen

RegExp_input_as_array.js

Source:RegExp_input_as_array.js Github

copy

Full Screen

1/* The contents of this file are subject to the Netscape Public2 * License Version 1.1 (the "License"); you may not use this file3 * except in compliance with the License. You may obtain a copy of4 * the License at http://www.mozilla.org/NPL/5 *6 * Software distributed under the License is distributed on an "AS7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or8 * implied. See the License for the specific language governing9 * rights and limitations under the License.10 *11 * The Original Code is Mozilla Communicator client code, released March12 * 31, 1998.13 *14 * The Initial Developer of the Original Code is Netscape Communications15 * Corporation. Portions created by Netscape are16 * Copyright (C) 1998 Netscape Communications Corporation. All17 * Rights Reserved.18 *19 * Contributor(s): 20 * 21 */22/**23 Filename: RegExp_input_as_array.js24 Description: 'Tests RegExps $_ property (same tests as RegExp_input.js but using $_)'2526 Author: Nick Lerissa27 Date: March 13, 199828*/2930 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';31 var VERSION = 'no version';32 startTest();33 var TITLE = 'RegExp: input';3435 writeHeaderToLog('Executing script: RegExp_input.js');36 writeHeaderToLog( SECTION + " "+ TITLE);3738 var count = 0;39 var testcases = new Array();4041 RegExp['$_'] = "abcd12357efg";4243 // RegExp['$_'] = "abcd12357efg"; RegExp['$_']44 RegExp['$_'] = "abcd12357efg";45 testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; RegExp['$_']",46 "abcd12357efg", RegExp['$_']);4748 // RegExp['$_'] = "abcd12357efg"; /\d+/.exec('2345')49 RegExp['$_'] = "abcd12357efg";50 testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec('2345')",51 String(["2345"]), String(/\d+/.exec('2345')));5253 // RegExp['$_'] = "abcd12357efg"; /\d+/.exec(RegExp.input)54 RegExp['$_'] = "abcd12357efg";55 testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec(RegExp.input)",56 String(["12357"]), String(/\d+/.exec(RegExp.input)));5758 // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.exec(RegExp.input)59 RegExp['$_'] = "abcd12357efg";60 testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.exec(RegExp.input)",61 null, /[h-z]+/.exec(RegExp.input));6263 // RegExp['$_'] = "abcd12357efg"; /\d+/.test('2345')64 RegExp['$_'] = "abcd12357efg";65 testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test('2345')",66 true, /\d+/.test('2345'));6768 // RegExp['$_'] = "abcd12357efg"; /\d+/.test(RegExp.input)69 RegExp['$_'] = "abcd12357efg";70 testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test(RegExp.input)",71 true, /\d+/.test(RegExp.input));7273 // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.test(RegExp.input)74 RegExp['$_'] = "abcd12357efg";75 testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.test(RegExp.input)",76 false, /[h-z]+/.test(RegExp.input));7778 // RegExp['$_'] = "abcd12357efg"; (new RegExp('\d+')).test(RegExp.input)79 RegExp['$_'] = "abcd12357efg";80 testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('\d+')).test(RegExp.input)",81 true, (new RegExp('\d+')).test(RegExp.input));8283 // RegExp['$_'] = "abcd12357efg"; (new RegExp('[h-z]+')).test(RegExp.input)84 RegExp['$_'] = "abcd12357efg";85 testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('[h-z]+')).test(RegExp.input)",86 false, (new RegExp('[h-z]+')).test(RegExp.input));8788 function test()89 {90 for ( tc=0; tc < testcases.length; tc++ ) {91 testcases[tc].passed = writeTestCaseResult(92 testcases[tc].expect,93 testcases[tc].actual,94 testcases[tc].description +" = "+95 testcases[tc].actual );96 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";97 }98 stopTest();99 return ( testcases );100 }101 ...

Full Screen

Full Screen

RegExp_input.js

Source:RegExp_input.js Github

copy

Full Screen

1/* The contents of this file are subject to the Netscape Public2 * License Version 1.1 (the "License"); you may not use this file3 * except in compliance with the License. You may obtain a copy of4 * the License at http://www.mozilla.org/NPL/5 *6 * Software distributed under the License is distributed on an "AS7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or8 * implied. See the License for the specific language governing9 * rights and limitations under the License.10 *11 * The Original Code is Mozilla Communicator client code, released March12 * 31, 1998.13 *14 * The Initial Developer of the Original Code is Netscape Communications15 * Corporation. Portions created by Netscape are16 * Copyright (C) 1998 Netscape Communications Corporation. All17 * Rights Reserved.18 *19 * Contributor(s): 20 * 21 */22/**23 Filename: RegExp_input.js24 Description: 'Tests RegExps input property'2526 Author: Nick Lerissa27 Date: March 13, 199828*/2930 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';31 var VERSION = 'no version';32 startTest();33 var TITLE = 'RegExp: input';3435 writeHeaderToLog('Executing script: RegExp_input.js');36 writeHeaderToLog( SECTION + " "+ TITLE);3738 var count = 0;39 var testcases = new Array();4041 RegExp.input = "abcd12357efg";4243 // RegExp.input = "abcd12357efg"; RegExp.input44 RegExp.input = "abcd12357efg";45 testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; RegExp.input",46 "abcd12357efg", RegExp.input);4748 // RegExp.input = "abcd12357efg"; /\d+/.exec('2345')49 RegExp.input = "abcd12357efg";50 testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec('2345')",51 String(["2345"]), String(/\d+/.exec('2345')));5253 // RegExp.input = "abcd12357efg"; /\d+/.exec(RegExp.input)54 RegExp.input = "abcd12357efg";55 testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec(RegExp.input)",56 String(["12357"]), String(/\d+/.exec(RegExp.input)));5758 // RegExp.input = "abcd12357efg"; /[h-z]+/.exec(RegExp.input)59 RegExp.input = "abcd12357efg";60 testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.exec(RegExp.input)",61 null, /[h-z]+/.exec(RegExp.input));6263 // RegExp.input = "abcd12357efg"; /\d+/.test('2345')64 RegExp.input = "abcd12357efg";65 testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test('2345')",66 true, /\d+/.test('2345'));6768 // RegExp.input = "abcd12357efg"; /\d+/.test(RegExp.input)69 RegExp.input = "abcd12357efg";70 testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test(RegExp.input)",71 true, /\d+/.test(RegExp.input));7273 // RegExp.input = "abcd12357efg"; (new RegExp('d+')).test(RegExp.input)74 RegExp.input = "abcd12357efg";75 testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('d+')).test(RegExp.input)",76 true, (new RegExp('d+')).test(RegExp.input));7778 // RegExp.input = "abcd12357efg"; /[h-z]+/.test(RegExp.input)79 RegExp.input = "abcd12357efg";80 testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.test(RegExp.input)",81 false, /[h-z]+/.test(RegExp.input));8283 // RegExp.input = "abcd12357efg"; (new RegExp('[h-z]+')).test(RegExp.input)84 RegExp.input = "abcd12357efg";85 testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('[h-z]+')).test(RegExp.input)",86 false, (new RegExp('[h-z]+')).test(RegExp.input));8788 function test()89 {90 for ( tc=0; tc < testcases.length; tc++ ) {91 testcases[tc].passed = writeTestCaseResult(92 testcases[tc].expect,93 testcases[tc].actual,94 testcases[tc].description +" = "+95 testcases[tc].actual );96 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";97 }98 stopTest();99 return ( testcases );100 }101 ...

Full Screen

Full Screen

TemplatedPathPlugin.js

Source:TemplatedPathPlugin.js Github

copy

Full Screen

1/*2 MIT License http://www.opensource.org/licenses/mit-license.php3 Author Jason Anderson @diurnalist4*/5"use strict";67const REGEXP_HASH = /\[hash(?::(\d+))?\]/gi,8 REGEXP_CHUNKHASH = /\[chunkhash(?::(\d+))?\]/gi,9 REGEXP_NAME = /\[name\]/gi,10 REGEXP_ID = /\[id\]/gi,11 REGEXP_FILE = /\[file\]/gi,12 REGEXP_QUERY = /\[query\]/gi,13 REGEXP_FILEBASE = /\[filebase\]/gi;1415// Using global RegExp for .test is dangerous16// We use a normal RegExp instead of .test17const REGEXP_HASH_FOR_TEST = new RegExp(REGEXP_HASH.source, "i"),18 REGEXP_CHUNKHASH_FOR_TEST = new RegExp(REGEXP_CHUNKHASH.source, "i"),19 REGEXP_NAME_FOR_TEST = new RegExp(REGEXP_NAME.source, "i");2021// TODO: remove in webpack 322// Backwards compatibility; expose regexes on Template object23const Template = require("./Template");24Template.REGEXP_HASH = REGEXP_HASH;25Template.REGEXP_CHUNKHASH = REGEXP_CHUNKHASH;26Template.REGEXP_NAME = REGEXP_NAME;27Template.REGEXP_ID = REGEXP_ID;28Template.REGEXP_FILE = REGEXP_FILE;29Template.REGEXP_QUERY = REGEXP_QUERY;30Template.REGEXP_FILEBASE = REGEXP_FILEBASE;3132const withHashLength = (replacer, handlerFn) => {33 return function(_, hashLength) {34 const length = hashLength && parseInt(hashLength, 10);35 if(length && handlerFn) {36 return handlerFn(length);37 }38 const hash = replacer.apply(this, arguments);39 return length ? hash.slice(0, length) : hash;40 };41};4243const getReplacer = (value, allowEmpty) => {44 return function(match) {45 // last argument in replacer is the entire input string46 const input = arguments[arguments.length - 1];47 if(value === null || value === undefined) {48 if(!allowEmpty) throw new Error(`Path variable ${match} not implemented in this context: ${input}`);49 return "";50 } else {51 return `${value}`;52 }53 };54};5556const replacePathVariables = (path, data) => {57 const chunk = data.chunk;58 const chunkId = chunk && chunk.id;59 const chunkName = chunk && (chunk.name || chunk.id);60 const chunkHash = chunk && (chunk.renderedHash || chunk.hash);61 const chunkHashWithLength = chunk && chunk.hashWithLength;6263 if(data.noChunkHash && REGEXP_CHUNKHASH_FOR_TEST.test(path)) {64 throw new Error(`Cannot use [chunkhash] for chunk in '${path}' (use [hash] instead)`);65 }6667 return path68 .replace(REGEXP_HASH, withHashLength(getReplacer(data.hash), data.hashWithLength))69 .replace(REGEXP_CHUNKHASH, withHashLength(getReplacer(chunkHash), chunkHashWithLength))70 .replace(REGEXP_ID, getReplacer(chunkId))71 .replace(REGEXP_NAME, getReplacer(chunkName))72 .replace(REGEXP_FILE, getReplacer(data.filename))73 .replace(REGEXP_FILEBASE, getReplacer(data.basename))74 // query is optional, it's OK if it's in a path but there's nothing to replace it with75 .replace(REGEXP_QUERY, getReplacer(data.query, true));76};7778class TemplatedPathPlugin {79 apply(compiler) {80 compiler.plugin("compilation", compilation => {81 const mainTemplate = compilation.mainTemplate;8283 mainTemplate.plugin("asset-path", replacePathVariables);8485 mainTemplate.plugin("global-hash", function(chunk, paths) {86 const outputOptions = this.outputOptions;87 const publicPath = outputOptions.publicPath || "";88 const filename = outputOptions.filename || "";89 const chunkFilename = outputOptions.chunkFilename || outputOptions.filename;90 if(REGEXP_HASH_FOR_TEST.test(publicPath) || REGEXP_CHUNKHASH_FOR_TEST.test(publicPath) || REGEXP_NAME_FOR_TEST.test(publicPath))91 return true;92 if(REGEXP_HASH_FOR_TEST.test(filename))93 return true;94 if(REGEXP_HASH_FOR_TEST.test(chunkFilename))95 return true;96 if(REGEXP_HASH_FOR_TEST.test(paths.join("|")))97 return true;98 });99100 mainTemplate.plugin("hash-for-chunk", function(hash, chunk) {101 const outputOptions = this.outputOptions;102 const chunkFilename = outputOptions.chunkFilename || outputOptions.filename;103 if(REGEXP_CHUNKHASH_FOR_TEST.test(chunkFilename))104 hash.update(JSON.stringify(chunk.getChunkMaps(true, true).hash));105 if(REGEXP_NAME_FOR_TEST.test(chunkFilename))106 hash.update(JSON.stringify(chunk.getChunkMaps(true, true).name));107 });108 });109 }110}111 ...

Full Screen

Full Screen

unicode_restricted_quantifiable_assertion.js

Source:unicode_restricted_quantifiable_assertion.js Github

copy

Full Screen

1// Copyright (C) 2015 André Bargull. All rights reserved.2// This code is governed by the BSD license found in the LICENSE file.3/*---4description: B.1.4 is not applied for Unicode RegExp - Production 'QuantifiableAssertion Quantifier'5info: >6 The compatibility extensions defined in B.1.4 Regular Expressions Patterns7 are not applied for Unicode RegExps.8 Tested extension: "ExtendedTerm :: QuantifiableAssertion Quantifier"9es6id: 21.1.210---*/11// Positive lookahead with quantifier.12assert.throws(SyntaxError, function() {13 RegExp("(?=.)*", "u");14}, 'RegExp("(?=.)*", "u"): ');15assert.throws(SyntaxError, function() {16 RegExp("(?=.)+", "u");17}, 'RegExp("(?=.)+", "u"): ');18assert.throws(SyntaxError, function() {19 RegExp("(?=.)?", "u");20}, 'RegExp("(?=.)?", "u"): ');21assert.throws(SyntaxError, function() {22 RegExp("(?=.){1}", "u");23}, 'RegExp("(?=.){1}", "u"): ');24assert.throws(SyntaxError, function() {25 RegExp("(?=.){1,}", "u");26}, 'RegExp("(?=.){1,}", "u"): ');27assert.throws(SyntaxError, function() {28 RegExp("(?=.){1,2}", "u");29}, 'RegExp("(?=.){1,2}", "u"): ');30// Positive lookahead with reluctant quantifier.31assert.throws(SyntaxError, function() {32 RegExp("(?=.)*?", "u");33}, 'RegExp("(?=.)*?", "u"): ');34assert.throws(SyntaxError, function() {35 RegExp("(?=.)+?", "u");36}, 'RegExp("(?=.)+?", "u"): ');37assert.throws(SyntaxError, function() {38 RegExp("(?=.)??", "u");39}, 'RegExp("(?=.)??", "u"): ');40assert.throws(SyntaxError, function() {41 RegExp("(?=.){1}?", "u");42}, 'RegExp("(?=.){1}?", "u"): ');43assert.throws(SyntaxError, function() {44 RegExp("(?=.){1,}?", "u");45}, 'RegExp("(?=.){1,}?", "u"): ');46assert.throws(SyntaxError, function() {47 RegExp("(?=.){1,2}?", "u");48}, 'RegExp("(?=.){1,2}?", "u"): ');49// Negative lookahead with quantifier.50assert.throws(SyntaxError, function() {51 RegExp("(?!.)*", "u");52}, 'RegExp("(?!.)*", "u"): ');53assert.throws(SyntaxError, function() {54 RegExp("(?!.)+", "u");55}, 'RegExp("(?!.)+", "u"): ');56assert.throws(SyntaxError, function() {57 RegExp("(?!.)?", "u");58}, 'RegExp("(?!.)?", "u"): ');59assert.throws(SyntaxError, function() {60 RegExp("(?!.){1}", "u");61}, 'RegExp("(?!.){1}", "u"): ');62assert.throws(SyntaxError, function() {63 RegExp("(?!.){1,}", "u");64}, 'RegExp("(?!.){1,}", "u"): ');65assert.throws(SyntaxError, function() {66 RegExp("(?!.){1,2}", "u");67}, 'RegExp("(?!.){1,2}", "u"): ');68// Negative lookahead with reluctant quantifier.69assert.throws(SyntaxError, function() {70 RegExp("(?!.)*?", "u");71}, 'RegExp("(?!.)*?", "u"): ');72assert.throws(SyntaxError, function() {73 RegExp("(?!.)+?", "u");74}, 'RegExp("(?!.)+?", "u"): ');75assert.throws(SyntaxError, function() {76 RegExp("(?!.)??", "u");77}, 'RegExp("(?!.)??", "u"): ');78assert.throws(SyntaxError, function() {79 RegExp("(?!.){1}?", "u");80}, 'RegExp("(?!.){1}?", "u"): ');81assert.throws(SyntaxError, function() {82 RegExp("(?!.){1,}?", "u");83}, 'RegExp("(?!.){1,}?", "u"): ');84assert.throws(SyntaxError, function() {85 RegExp("(?!.){1,2}?", "u");86}, 'RegExp("(?!.){1,2}?", "u"): ');...

Full Screen

Full Screen

hex-001.js

Source:hex-001.js Github

copy

Full Screen

1/**2 * File Name: RegExp/hex-001.js3 * ECMA Section: 15.7.3.14 * Description: Based on ECMA 2 Draft 7 February 19995 * Positive test cases for constructing a RegExp object6 * Author: christine@netscape.com7 * Date: 19 February 19998 */9 var SECTION = "RegExp/hex-001";10 var VERSION = "ECMA_2";11 var TITLE = "RegExp patterns that contain HexicdecimalEscapeSequences";1213 startTest();1415 // These examples come from 15.7.1, HexidecimalEscapeSequence1617 AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] );18 AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] );19 AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] );2021 AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] );22 AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x412", "\\x412", 1, 0, ["A"] );23 AddRegExpCases( new RegExp("^x"), "new RegExp('^x')", "x412", "x412", 1, 0, ["x"]);24 AddRegExpCases( new RegExp("A"), "new RegExp('A')", "A2", "A2", 1, 0, ["A"] );2526 test();2728function AddRegExpCases(29 regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {3031 // prevent a runtime error3233 if ( regexp.exec(pattern) == null || matches_array == null ) {34 AddTestCase(35 str_regexp + ".exec(" + pattern +")",36 matches_array,37 regexp.exec(pattern) );3839 return;40 }4142 AddTestCase(43 str_regexp + ".exec(" + str_pattern +").length",44 length,45 regexp.exec(pattern).length );4647 AddTestCase(48 str_regexp + ".exec(" + str_pattern +").index",49 index,50 regexp.exec(pattern).index );5152 AddTestCase(53 str_regexp + ".exec(" + str_pattern +").input",54 pattern,55 regexp.exec(pattern).input );5657 for ( var matches = 0; matches < matches_array.length; matches++ ) {58 AddTestCase(59 str_regexp + ".exec(" + str_pattern +")[" + matches +"]",60 matches_array[matches],61 regexp.exec(pattern)[matches] );62 } ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const rp = require('request-promise');3const cheerio = require('cheerio');4const fs = require('fs');5const path = require('path');6const url = require('url');7const request = require('request');8const async = require('async');9const _ = require('underscore');10const prompt = require('prompt');11const jsonfile = require('jsonfile');12const file = 'test.json';13const file2 = 'test2.json';14const file3 = 'test3.json';15const file4 = 'test4.json';16const file5 = 'test5.json';17const file6 = 'test6.json';18const file7 = 'test7.json';19const file8 = 'test8.json';20const file9 = 'test9.json';21const file10 = 'test10.json';22const file11 = 'test11.json';23const file12 = 'test12.json';24const file13 = 'test13.json';25const file14 = 'test14.json';26const file15 = 'test15.json';27const file16 = 'test16.json';28const file17 = 'test17.json';29const file18 = 'test18.json';30const file19 = 'test19.json';31const file20 = 'test20.json';32const file21 = 'test21.json';33const file22 = 'test22.json';34const file23 = 'test23.json';35const file24 = 'test24.json';36const file25 = 'test25.json';37const file26 = 'test26.json';38const file27 = 'test27.json';39const file28 = 'test28.json';40const file29 = 'test29.json';41const file30 = 'test30.json';42const file31 = 'test31.json';43const file32 = 'test32.json';44const file33 = 'test33.json';45const file34 = 'test34.json';46const file35 = 'test35.json';47const file36 = 'test36.json';48const file37 = 'test37.json';49const file38 = 'test38.json';50const file39 = 'test39.json';51const file40 = 'test40.json';52const file41 = 'test41.json';53const file42 = 'test42.json';54const file43 = 'test43.json';55const file44 = 'test44.json';

Full Screen

Using AI Code Generation

copy

Full Screen

1function wptexturize(str) {2 var single = [ "'", '"', '`', '’', '‘', '“', '”', '′', '″' ];3 var openingSingle = [ '‘', '“', '‚', '„', '′', '″' ];4 var closingSingle = [ '’', '”', '’', '”', '′', '″' ];5 var apostrophe = '’';6 var openingDouble = '“';7 var closingDouble = '”';8 var comma = ',';9 var period = '.';10 var ellipsis = '…';11 var openEllipsis = '‥';12 var perMille = '‰';13 var perTenThousand = '‱';14 var question = '?';15 var exclamation = '!';16 var numberSign = '#';17 var ampersand = '&';18 var asterisk = '*';19 var plus = '+';20 var minus = '-';21 var lessThan = '<';22 var greaterThan = '>';23 var equal = '=';24 var underscore = '_';25 var bar = '|';26 var tilde = '~';27 var colon = ':';28 var semicolon = ';';29 var dollar = '$';30 var percent = '%';31 var at = '@';32 var zeroWidthSpace = "\u200B";33 var regex;34 var character;35 var i;36 var l;37 var match;38 var next;39 var prev;40 var space;41 var textarr = str.split('');42 var entityMap = {43 '&amp;' : '&',44 '&#038;' : '&',45 '&lt;' : '<',46 '&gt;' : '>',47 '&quot;' : '"',48 '&#8220;' : '"',49 '&#8221;' : '"',50 '&#8243;' : '"',51 '&#x0201c;' : '"',52 '&#x0201d;' : '"',53 '&#8216;' : "'",54 '&#8217;' : "'",55 '&#8242;' : "'",56 '&#x02018;' : "'",57 '&#x02019;' : "'",58 '&#8218;' : "'",59 '&#x0201a;' : "'",60 '&#x02039;' : "'

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2wptools.page('Barack Obama').then(function(page){3 page.get().then(function(data){4 console.log(data.infobox);5 });6});7const wptools = require('wptools');8wptools.page('Barack Obama').then(function(page){9 page.get().then(function(data){10 console.log(data.coordinates);11 });12});13const wptools = require('wptools');14wptools.page('Barack Obama').then(function(page){15 page.get().then(function(data){16 console.log(data.categories);17 });18});19const wptools = require('wptools');20wptools.page('Barack Obama').then(function(page){21 page.get().then(function(data){22 console.log(data.links);23 });24});25const wptools = require('wptools');26wptools.page('Barack Obama').then(function(page){27 page.get().then(function(data){28 console.log(data.images);29 });30});31const wptools = require('wptools');32wptools.page('Barack Obama').then(function(page){33 page.get().then(function(data){34 console.log(data.references);35 });36});37const wptools = require('wptools');38wptools.page('Barack Obama').then(function(page){39 page.get().then(function(data){40 console.log(data.templates);41 });42});43const wptools = require('wptools');44wptools.page('Barack Obama').then(function(page){45 page.get().then(function(data){46 console.log(data.langlinks);47 });48});49const wptools = require('wptools');50wptools.page('Barack Obama').then(function(page

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var regExp = require('regExp');3var wiki = wptools.page('India');4wiki.get(function(err, resp) {5 var infobox = resp.infobox;6 var infoboxArray = regExp(infobox);7 console.log(infoboxArray);8});9var regExp = function(infobox) {10 var infoboxArray = [];11 var infoboxKeys = [];12 var infoboxValues = [];13 var infoboxKeys = Object.keys(infobox);14 var infoboxValues = Object.values(infobox);15 for (var i = 0; i < infoboxKeys.length; i++) {16 if (infoboxKeys[i] != 'image') {17 infoboxArray.push(infoboxKeys[i] + ':' + infoboxValues[i]);18 }19 }20 return infoboxArray;21}22var regExp = function(infobox) {23 var infoboxArray = [];24 var infoboxKeys = [];25 var infoboxValues = [];26 var infoboxKeys = Object.keys(infobox);27 var infoboxValues = Object.values(infobox);28 for (var i = 0; i < infoboxKeys.length; i++) {29 if (infoboxKeys[i] != 'image') {30 infoboxArray.push(infoboxKeys[i] + ':' + infoboxValues[i]);31 }32 }33 return infoboxArray;34}

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptexturize = require("wptexturize");2console.log(wptexturize("Hello, I'm a string with 'single quotes' and \"double quotes\"."));3const wptexturize = require("wptexturize");4console.log(wptexturize("Hello, I'm a string with 'single quotes' and \"double quotes\"."));5const wptexturize = require("wptexturize");6console.log(wptexturize("Hello, I'm a string with 'single quotes' and \"double quotes\"."));7const wptexturize = require("wptexturize");8console.log(wptexturize("Hello, I'm a string with 'single quotes' and \"double quotes\"."));9const wptexturize = require("wptexturize");10console.log(wptexturize("Hello, I'm a string with 'single quotes' and \"double quotes\"."));11const wptexturize = require("wptexturize");12console.log(wptexturize("Hello, I'm a string with 'single quotes' and \"double quotes\"."));13const wptexturize = require("wptexturize");

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptb = require('wptb');2var str = "I am a software engineer";3var patt = new RegExp("software");4console.log(wptb.test(str, patt));5var wptb = require('wptb');6var str = "I am a software engineer";7var patt = new RegExp("software");8console.log(wptb.test(str, patt));9var wptb = require('wptb');10var str = "I am a software engineer";11var patt = new RegExp("software");12console.log(wptb.test(str, patt));13var wptb = require('wptb');14var str = "I am a software engineer";15var patt = new RegExp("software");16console.log(wptb.test(str, patt));17var wptb = require('wptb');18var str = "I am a software engineer";19var patt = new RegExp("software");20console.log(wptb.test(str, patt));21var wptb = require('wptb');22var str = "I am a software engineer";23var patt = new RegExp("software");24console.log(wptb.test(str, patt));25var wptb = require('wptb');26var str = "I am a software engineer";27var patt = new RegExp("software");28console.log(wptb.test(str, patt));29var wptb = require('wptb');30var str = "I am a software engineer";31var patt = new RegExp("software");32console.log(wptb.test(str, patt));

Full Screen

Using AI Code Generation

copy

Full Screen

1var regExp = new RegExp( /<p>.*<\/p>/g );2var text = '<p>some text</p>';3var replacedText = text.replace( regExp, '<p>replaced text</p>' );4console.log( replacedText );5var regExp = new RegExp( /<p>.*<\/p>/g );6var text = '<p>some text</p>';7var replacedText = text.replace( regExp, '<p>replaced text</p>' );8console.log( replacedText );9var regExp = new RegExp( /<p>.*<\/p>/g );10var text = '<p>some text</p>';11var replacedText = text.replace( regExp, '<p>replaced text</p>' );12console.log( replacedText );13var regExp = new RegExp( /<p>.*<\/p>/g );14var text = '<p>some text</p>';15var replacedText = text.replace( regExp, '<p>replaced text</p>' );16console.log( replacedText );17var regExp = new RegExp( /<p>.*<\/p>/g );18var text = '<p>some text</p>';19var replacedText = text.replace( regExp, '<p>replaced text</p>' );20console.log( replacedText );21var regExp = new RegExp( /<p>.*<\/p>/g );22var text = '<p>some text</p>';23var replacedText = text.replace(

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful