Return to Snippet

Revision: 68764
at February 21, 2015 09:49 by jatubio


Initial Code
function regex_and($array)
{
	return '(?=.*'.implode(')(?=.*',$array).')';
}

Initial URL

                                

Initial Description
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)

Initial Title
Create a regex expression with operator 'AND'

Initial Tags
regex

Initial Language
PHP