Hi I am trying to create regex expression and I am running into problems.
Basically this is what I have:
(.+?)(and|or)(.+?)
What I am looking for example:
(user email ends with "@email.com" and user name is "John") or (user email ends with "@domain.com" and user name is "Bob")
And my expected result that I would like to have is:
(user email ends with "@email.com" and user name is "John")
(user email ends with "@domain.com" and user name is "Bob")
Basically the OR will split based on the "()" which is optional so I can have something like this
user email ends with "@email.com" and user name is "John"
Which I am expecting to be like this :
user email ends with "@email.com"
user name is "John"
if I have to have more than one regex I'm find with that, The end goal is something like this for the above:
Array
(
[0] => Array
(
[0] => user email ends with "@email.com"
[1] => user name is "John"
)
[1] => Array
(
[0] => user email ends with "@domain.com"
[1] => user name is "Bob"
)
)
If it is something like this
(user email ends with "@email.com" and user name is "John") or ((user email ends with "@domain.com" and user name is "Bob") or (user id is 5))
Then i'd expect something like this
Array
(
[0] => Array
(
[0] => user email ends with "@email.com"
[1] => user name is "John"
)
[1] => Array
(
[0] => user email ends with "@domain.com"
[1] => user name is "Bob"
[2] => Array
(
[0] => user id is 5
)
)
)
Any help will be much appreciated!