php clean up regex

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-04-25T23:33:03Z Indexed on 2010/04/25 23:43 UTC
Read the original article Hit count: 186

Filed under:
|

hey can i clean up a preg_match in php from this:

preg_match_all("/(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?/",$value,$match);

to look like this:

preg_match_all("/
   (".$this->reg['wat'].")?
   (".$this->reg['wat'].")?
   (".$this->reg['wat'].")?
   (".$this->reg['wat'].")?
   (".$this->reg['wat'].")?
   (".$this->reg['wat'].")?
   (".$this->reg['wat'].")?
/",$value,$match);

right now each space, it counts as a ling break so it wont return any finds when searching. but it just looks cleaner and easier to read is why i ask you know. i was looking for one of those letters to add after the closing "/" in the regex. thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about regex