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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -