I'm wondering how to change this exact php regex feature into javascript?
$ismatch= preg_match('|She is a <span><b>(.*)</b></span>|si', $sentence, $matchresult);
if($ismatch)
{
$gender= $matchresult[1];
}
else{ //do other thing }
I'm wondering how to change this exact php regex feature into javascript?
|
|||||||||
closed as too localized by Juhana, knittl, kapa, bmargulies, mario Mar 4 '12 at 21:09This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. |
|||||||||
|
This is not quite trivial since JavaScript doesn't support the The equivalent regex object would be
The functionality of the code (extracting group 1 from the match if there is a match) would be done in JavaScript like this:
|
|||||||||||||||||
|