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

The following works (assuming X as the optional character):

perl -e '$string="abcX123"; $string =~ /.*X(\S+)/; print $1;'

I do not understand why you are using X?