Perl Programming Help:
need some help
Jan 22, 2001, 9:32 AM
Can someone explain to me what does this expression does? I think it checks for digits and maybe characters but I am not sure. Thanks.
($argument =~ /^[sS][cC][\d+][\w*]/)
Jan 22, 2001, 10:12 AM
I think the author didn't know what they were doing...
I suspect it was meant to be:
^ # beginning of string
[sS] # an 's' or 'S'
[cC] # a 'c' or 'C'
[\d+] # a digit (0-9) or '+'
[\w*] # a word char (a-z, A-Z, 0-9, _) or '*'
The /i modifier there allows case-insensitive matching, meaning the 's' can match either an 's' or an 'S'.
Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author