Gossamer Forum
Home : General : Perl Programming :

Regex again.

Quote Reply
Regex again.
my $count;
my $description = "This is my description and it contains numerous __ double underscore marks and __ these mark some special area in the
field";

$count++ while $description =~ /(__)/gi;

############
The above code will give 1 if __ is found in the description 2 if __ and __ found in the field and so on.

My problem is I want to get the same result even upto six under scores in a row. i.e.

______ (six underscores in a row or less) should equal one. (1-6 underscores should equal one).

Any ideas?

Last edited by:

zeshan: Jul 9, 2003, 6:20 PM
Subject Author Views Date
Thread Regex again. zeshan 5410 Jul 9, 2003, 6:19 PM
Post Re: [zeshan] Regex again.
dan 5301 Jul 9, 2003, 7:37 PM
Thread Re: [zeshan] Regex again.
adrockjames 5317 Jul 10, 2003, 8:23 AM
Thread Re: [adrockjames] Regex again.
Paul 5286 Jul 10, 2003, 9:56 AM
Thread Re: [Paul] Regex again.
adrockjames 5299 Jul 10, 2003, 10:03 AM
Post Re: [adrockjames] Regex again.
Paul 5279 Jul 10, 2003, 10:07 AM