in reply to Capturing everything after an optional character in a regex?

I'm not sure if it's what you're looking for (i.e. doesn't break something else somewhere else...) but I find that:
perl -e '$string="abcX123"; $string =~ /X+?(\S+)/; print $1;'
works for me... HTH

Replies are listed 'Best First'.
Re: Re: Capturing everything after an optional character in a regex?
by Anonymous Monk on Dec 10, 2003 at 03:52 UTC
    $string = "abcX123"; ($afterX) = ($string =~ /X(.*)/); print $afterX;