regex - How to use alternation in character class -


without being specific particular programming language i've been looking @ regular expressions.

as understand alternative notation a|b using character class [ab].

so if have regex ab|cd reads a followed b or c followed d how can use character class this?

this assume wouldn't work: [abcd] right answer: [(ab)(cd)] - looks bit strange me reason.

character class alone match single character. here need use capturing or non-capturing group if want apply or group of characters.

(ab|cd) 

or

(?:ab|cd) 

Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

php - Mongodb connectivity error -