php - Preg_match_all grab value from string -
example:
$word = "your ip address=10.0.0.1</br>my ip address=127.0.0.1</br>";
how can taking ip address string using preg_match_all?
a pragmatic attempt in case match between =
, </br>
:
preg_match_all('~=(.*?)</br>~', $string, $matches); var_dump($matches);
note ?
marks ungreedy match. if omit following match:
10.0.0.1</br>my ip address=127.0.0.1
of course need preg_match_all()
every match (ip) not first.
Comments
Post a Comment