Posted By

jatubio on 02/21/15


Tagged

regex regpath


Versions (?)

Create a regex expression with operator 'AND'


 / Published in: PHP
 

Build a regex expression to all array elements are present in any order. Gets an array of strings (Sample: array("Access Denied","error","could not be retrieved") Return sample: '(?=.Access Denied)(?=.error)(?=.*could not be retrieved)

  1. function regex_and($array)
  2. {
  3. return '(?=.*'.implode(')(?=.*',$array).')';
  4. }

Report this snippet  

You need to login to post a comment.