Reputation: 1902
The rules of the regex are simple:
" "
followed by 'OR' or '|' :Example:
"thing to say" france (true)
"thing to say" OR thing (false)
"thing to say" | thing (false)
I'm trying to find a regex to help me do that (with a pregs_split)
I only could do something like /\||OR| \|| OR| \| | OR |\| | OR/
really basic but I need a regex for the opposite case.
Upvotes: 0
Views: 219
Reputation: 191729
Use a negative lookahead
"thing to say" ?(?!\||OR)
EDIT: your comment split by a space followed by "OR" or "|"
is different than what I understood your question to be. In that case it would actually make sense to use a positive lookahead:
/ (?=\||OR)/
Upvotes: 5