Your regex is a bit hard to read to say the least, what with the lack of proper code tags, but I think it looks like this:
my $exp = $line =~ m/[FAR PASCAL|FAR PASCAL_CONV] (.*)/gi;
Is that right? If so: square brackets indicate a character class, so [FAR PASCAL|FAR PASCAL_CONV] will match any of "|_ ACFLNOPRSV". What you're looking for is either regular parentheses or, if you want to avoid capturing, (?:) (non-capturing parentheses), e.g. like this:
$line =~ m/(?:FAR PASCAL(?:_CONV)?) (.*)/i;
If you're only doing a single match, the /g modifier is unnecessary as well; furthermore, the m// operator returns the number of matches in scalar context. If you'd like to store captures for later use, use it in list context:
$line = "FAR PASCAL_CONV blurb";
my ($expr) = $line =~ m/(?:FAR PASCAL(?:_CONV)?) (.*)/i;
# $expr now contains "blurb";
I hope this helps.
|