Thursday, 15 August 2013

javascript - Matching content within a string with one regex -



javascript - Matching content within a string with one regex -

this question has reply here:

how pass variable regular look javascript? 16 answers simple way utilize variables in regex 3 answers

i looking way regex match string (double quote followed 1 or more letter, digit, or space followed double quote). example, if input var s = "\"this string\"", create regex match string , produce result of [""this string""].

thank you!

use regexp constructor function.

var s = "this string"; var re = new regexp(s);

note may need quote input string.

javascript regex

No comments:

Post a Comment