Javascript regex to extract all characters between quotation marks following a specific word

后端 未结 2 883
情深已故
情深已故 2021-01-22 00:34

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=\"\"
         


        
2条回答
  •  感动是毒
    2021-01-22 01:35

    Can'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];
    }
    

提交回复
热议问题