This is my first try at regex in PHP. I would like to use regex in PHP to match sentences that contains two set of words. I have tested it like below but it's not working
$regex= (red|green|round|sweet)[^.]*(apple|apples)
$sentence = "I have two red apples."
if(preg_match($regex, $sentence))
{
echo 'MATCH!!!';
} else {
echo 'No MATCH!!!';
}
I am getting an error message in PHP.
Warning: preg_match(): Unknown modifier [