Mike Lesser <mailto:[EMAIL PROTECTED]> wrote:
: For example, if I have a string that goes like
:
: "Joe Shmoe (alphanumerics)"
:
: and I want to get the alphanumerics between the parens, It's like
: pulling teeth, I think (i think..) what I want to do is match the
: stuff that's _not_ between the: parens, and substitute that to
: nothing? Is that how to do it?
Start with the starting character and capture the interior by
matching everything except the closing character.
use strict;
use warnings;
my $phrase = 'Joe Shmoe (alphanumerics)';
print $1 if $phrase =~
m/
\( # Start with the starting character.
( # Start the capture.
[^)]+ # Capture everything in a class which
# excludes the closing character.
) # Close the capture.
/x;
__END__
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>