N, Guruguhan (GEAE, Foreign National, EACOE) wrote:
Hi All, I wanted to check whether the user input is only a number and does contain any alphabet/s anywhere i.e. starting, end or in-between. Can somebody tell me how to do this?
TIA
Guruguhan
Hey,
Please wrap your lines :-)
To match 4blabla4 you can do
if ( $line =~ m/^\d[a-z]{6}\d$/ ) to match a digit at the start of the line , 6x a till z, and a digit again but then at the end of the line.
\d = match one digit \d+ = match more digits
[a-z] match any alphabetic letter x{6} number of occurences of x (how manytimes does x must match)
^ = begin of the line $ = end of the line
Do you mean that?
-- Kind regards,
Remko Lodder |[EMAIL PROTECTED] Reporter DSINet |[EMAIL PROTECTED] Projectleader Mostly-Harmless |[EMAIL PROTECTED]
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>