Use ? To indicate a character that can appear zero or one time.
For example:
$ perl -e "print '2000-20-30' =~ /\d{4}-?\d{2}-?\d{2}/" 1 $ perl -e "print '20002030' =~ /\d{4}-?\d{2}-?\d{2}/" 1
Hazah! I'm Employed!
In reply to Re: simple regexp question
by osunderdog
in thread simple regexp question
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |