If you really want a regexp:

if (/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*$/) {

This looks for ^ (the beginning of the line), [^:]* (0 or more characters
that are not ':'), : (a colon), and ultimately $ the end of the line.

                        /\/\ark

-----Original Message-----
From: Stuart Clark [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 11, 2002 7:32 PM
To: perllist
Subject: Troubles with reg exp


Hi All,
I'm having trouble with this regular expression
I have data file with colon separated delimiters
The data below has 6 colon delimiters
I want to check to make sure that none of the lines of data has more or less
than 6 colons in it (EG: Lets say David enters his phone number as
9876:4342)
The rest of my file works ok, its just matching the 6 colons.

# File
David:smith:21 lake drv::98764342::
John:Jones:44 ratfink st:west mouseville:8432321::
##


I have tried this

if ($_ =~ m/:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:/) {

and

if ($_ = ~ m/:{6}/) {

Regards
Stuart Clark




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to