Article View: comp.lang.perl.misc
Article #323Re: How to search ******
From: Mike Stok
Date: Tue, 15 Jul 1997 00:00
Date: Tue, 15 Jul 1997 00:00
31 lines
1444 bytes
1444 bytes
In article <33CAFAC4.2013B7C3@csc.albany.edu>,
Chao Shao-ju <sc7489@csc.albany.edu> wrote:
>Hi,
>
>I tried to search a line that contains more than one star (*) , using:
>
>if ($line =~ /\*\*/)
>{
>................
>}
if ($line =~ /\*+/) { ... }
or the regex you're using will match one or more consecutive * characters
anywhere on the line,
if ($line =~ tr/*/*/ > 1) { ... }
will count the number of * anywhere in $line and see if there are more
than one.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
Technical Details
Message-ID:
<5qg24f$9tc@news-central.tiac.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<33CAFAC4.2013B7C3@csc.albany.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1133f4,b92671e9260cc62 X-Google-Attributes: gid1133f4,public X-Google-Thread: 112333,b92671e9260cc62 X-Google-Attributes: gid112333,public X-Google-Thread: fa0ae,b92671e9260cc62 X-Google-Attributes: gidfa0ae,public From: mike@stok.co.uk (Mike Stok) Subject: Re: How to search ****** Date: 1997/07/15 Message-ID: <5qg24f$9tc@news-central.tiac.net> X-Deja-AN: 256994494 References: <33CAFAC4.2013B7C3@csc.albany.edu> Organization: Pencom Systems Administration Newsgroups: comp.lang.perl.misc,de.comp.lang.perl,fr.comp.lang.perl