regex - How to check for two words ('goat' and 'sheep') with preg_match in PHP? -


how check 2 words (example 'sheep' , 'goat') preg_match in php?

example:

if (!preg_match(goat|sheep)) header(' location: / '); 

thanks!

simply this:

if (!preg_match('~\b(?:goat|sheep)\b~i', $yourstring)) header('location: /'); 

more informations here , here


Comments

Popular posts from this blog

matlab - How to equate a structure array to structure array -

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -