develooper Front page | perl.beginners | Postings from February 2002

Troubles with reg exp

Thread Next
From:
Stuart Clark
Date:
February 11, 2002 19:30
Subject:
Troubles with reg exp
Message ID:
007601c1b375$d758c870$bd00a8c0@spacelink.net.au
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




Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About