I have the text:
s.events=\"event3\"
s.pageName=\"Forum: Index\"
s.channel=\"forum\"
s.prop1=\"Forum: Index\"
s.prop2=\"Index Page\"
s.prop36=\"\"
s.prop37=\"\"
Use this:
var myregex = /s\.prop42="([^"]*)"/;
var matchArray = myregex.exec(yourString);
if (matchArray != null) {
thematch = matchArray[1];
}
In the regex demo, look at the capture group in the right pane.
Explanation
s\.prop42="
matches s.prop42="
(but we won't retrieve it)([^"]*)
capture any chars that are not a "
to Group 1: this is what we wantCan't comment on above answer, but I think the regex is better with .* like so:
var myregex = /s\.prop42="(.*)"/;
var matchArray = myregex.exec(yourString);
if (matchArray != null) {
thematch = matchArray[1];
}