my $pattern = qr/ S[s|p] # match the link label (?:[\w\*]{1,2})* # match any optional subscripts :(\d+): # match number of the word (\w+(?:\.\w)*) # match and save the word itself [^\)]+ # match other stuff within parenthesis "(rock[s|ed]*).v"# match and store verb [^(?:O.{1,2}: # don't match objects \d+\:\w+(?:\.\w)*)]*\) /xm;