in reply to use of 'or' in regex

You may be interested to know that the output of:
$str = "ABCDEFGHIJKLM"; while ($str =~ /(BC|GH|LM)/g) { print "matched $1\n"; }
is:
matched BC matched GH matched LM
Which I think is what you needed. You'll get a match line for each of them, so long as they don't overlap.

--
Steve Marvell