javascript - Regex matching whats inside quotes but not the same quote inside the line -
I'm trying this regex / ([']) ((?: (?! \ 1 ) [^ \\] | (?: \\\\) * \\ [^ \\]) *) \ 1 /
to collect in an array of "variable" list from a GET
response to
looks like a string:
"var chatbox_messages = '& lt; p class =" chatbox_row_1 clearfix "> & amp; nbsp; & lt; span style =" font-style: italic "& gt; you are disconnected. & Lt; / span & Gt; & lt; / span & gt; & lt; / p & gt; 'var chatbox_maillist =' & lt; h4 class = "member-title online" & gt; online & lt; / h4 & gt; Lt; ul class = "online-user">
The above string is just X overflow and it's annoying ...
Anyway, this code was previously using code to eval
and I do not use eval so I try to fix the code and get the parameter I am so that I just
var response = responseText.match (/ ([]) ((: (1) [^ \\] | (?!? \\\\) * \\ [^ \\]) *) \ 1 / g) Var message = response [0]; var second_message = response [1];
Although I am using None of the regex will really receive what I want! It either split the variable into pieces of the string or catches the first quotation marks to '
and I do not have them at all Wish ...
Can anyone help me Jump or move me in the right direction.
Just do it in your match:
var newMatchWithoutQuotes = match. Replace ("'", "");
This quote will be removed;
Comments
Post a Comment