开发者

PHP: Match line against array of regexes

开发者 https://www.devze.com 2023-01-16 23:10 出处:网络
I\'m writing a quick PHP parser here and was wondering instead of writing foreach($array as $line) { if(preg_match($regex1, ..) {

I'm writing a quick PHP parser here and was wondering instead of writing

foreach($array as $line) {
  if(preg_match($regex1, ..) {

  } 
  elseif(preg_match($regex2, ..) {

  }
}

Is there possible to match agai开发者_JS百科nst an array of regexes?


foreach($text_array as $line){
    foreach($regex_array as $regex{
        ...
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消