Thursday, 12 September 2013

What is the Regular expression for multiple word combinations

What is the Regular expression for multiple word combinations

Can some one help me to find a regular expression for the pattern below,
I am trying to use regular expression to match a patter in shell script.
The pattern could be a combination of 'ab' 'xy' 'ij' 'pqr', in any order
and seperated by a comma ',' or only 'all'
Ex.
1) "ab,xy,ij,pqr" - valid
2) "ij,pqr" - valid
3) "all" - valid
4) "ij,ab," - invalid because it ends with a comma
5) "all,xy" - invalid because 'all' cannot be combined with xy ij pqr or ab
6) ",xy" - invalid because it starts with comma
7) "xy" - valid
Thank you.

No comments:

Post a Comment