Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Counting characters within regexp

by hippo (Bishop)
on May 09, 2021 at 11:01 UTC ( [id://11132301]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Counting characters within regexp
in thread Counting characters within regexp

Here is how to use a character class to achieve that.

use strict; use warnings; use Test::More; my @good = ( 'a', '9', '_', ); my @bad = ( '-', '$', '?', ); my $re = qr/[\w.]/; plan tests => @good + @bad; like $_, $re, "match for '$_'" for @good; unlike $_, $re, "no match for '$_'" for @bad;

🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132301]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found