Hi, I am trying to create a regex expression, and I ran into problems.Basically this is what I have:
(.+?)(and|or)(.+?)
What I'm looking for:
(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, OR will break down based on "()", which is optional, so I can have something like this
user email ends with "@email.com" and user name is "John"
Which I expect to be like this:
user email ends with "@email.com"
user name is "John"
If I need to have more than one regular expression, I will find with this, The ultimate 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's 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 would 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 would be greatly appreciated!