basic regex help

kds9100

New Member
\[code\]$text_expression = 'word1 word2 "phrase 1" "phrase 2" -word3 -word4 -"phrase \"hello\" 3" -"phrase 4"';\[/code\]i want to search strings that contains (word1 OR word2 OR 'phrase 1' OR 'phrase 2') AND doesn't contain (word3 OR word4 OR 'phrase "hello" 3' OR 'phrase 4')what would be the regex expression that is equivalent of $text_expression above? which produces an array like;[contains] => array ( \[code\][0] => word1 [1] => word2 [2] => phrase 1 \[/code\])[doesnt contain] => array (\[code\][0] => word3 [1] => word4 [2] => phrase "hello" 3\[/code\])ps: I can formulate the string another way if it's going to make it easier (e.g. use other chars instead of quotes and dashes)
 
Back
Top