Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $string = ' <a href="wrong.html">Wrong link</a></li> <ul> <li><a href="index.html">Hi</a></li> <li><a href="http://google.ru/">there</a></li> <li><a href="#some_ancor">Link content</a></li> <li><a href="#">Something else</a></li> <li>bla <a href="#">Something else too</a> </li> </ul> '; $pattern = '#<li>[.\s]?<a[^>]*>(.+?)</a>[.\s]?</li>#is'; $new = preg_match_all($pattern, $string, $arr); print_r ($arr); ?>
Copy Clear