how to split a query with ‘AND’ and/or ‘OR’ arguments in it in jquery?
Suppose iam having
A=( 1=1,FirstName='aaa' or FirstName='bbb' and FirstName='ccc' or FirstName='ddd' and FirstName='eee')
Now i want to split ‘A’ with ‘and’ & ‘or’ and get the result as below
A=(FirstName='aaa' , FirstName='dddd' , FirstName='bbb' , FirstName='dddd' , FirstName='cccc')
but the thing is i may or may not have ‘or’ in the query, still it should produce a o/p with all the values after split. Please help.
Different types of queries could be as below:
A=( 1=1,FirstName='aaa' or FirstName='bbb' and FirstName='ccc' or FirstName='eee' and FirstName='fff')
A=( 1=1,FirstName='aaa' and FirstName='bbb' and FirstName='ccc' and FirstName='ddd' and FirstName='fff')
A=( 1=1,FirstName='aaa' or FirstName='bbb' or FirstName='ccc' or FirstName='ddd' or FirstName='fff')
Query is not static i just gave an example, it could be any string.
A little know fact is that you can pass a regular expression as a separator to the String
.split()method.