Quantcast
Channel: Documentation for ?: in regex? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by Alex Pliutau for Documentation for ?: in regex?

$
0
0

I don't know how do this with ?:, but it is easy with simple loop:

$regex = '/b(ig|all)/';$array = array(    0 => array(0 => 'big', 1 => 'ball'),    1 => array(0 => 'ig', 1 => 'all'));foreach ($array as $key => $row) {    foreach ($row as $val) {        if (!preg_match($regex, $val)) {            unset($array[$key]);        }    }}print_r($array);

Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>