What doesn't work about it? It works just fine for me given what little I know about your input. I.e., when I feed it lines like "SW: foo", "SW= foo" and "SW foo", they all match. Also, since by "combining" the REs you've made the mandatory colon optional, you could just do this: /SW[:=]?\s*([^\s;,\n\r]+)/ That is, use a character class.
What do you mean "ignore the word SWITCH"? One way of ignoring words is making sure they are not there. Try s/SWITCH// prior to the match.
In reply to Re: combining RegEx
by duff
in thread combining RegEx
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |