I have following string
Casas (3)
I want to get the number three out of it .
in Jquery I am using this regex
regExp = /\(([^)]+)\)/;
But i dont know how to do that in PHP
Thanks in advance
I have following string
Casas (3)
I want to get the number three out of it .
in Jquery I am using this regex
regExp = /\(([^)]+)\)/;
But i dont know how to do that in PHP
Thanks in advance
You can try something like this :
<?php
$text = 'Casas (3)';
preg_match('#\((.*?)\)#', $text, $match);
print $match[1];
?>
Hope it helps..
Try this
$str = "Casas (3)";
preg_match_all('!\d+!', $str, $matches);
print_r($matches);
Use preg_match with your regular expression
$f = 'Casas (3)';
preg_match('/\(([^)]+)\)/', $f, $fr)
echo $fr[1];