Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Dynamic matching

by wind (Priest)
on Mar 14, 2014 at 02:24 UTC ( [id://1078270]=note: print w/replies, xml ) Need Help??


in reply to Dynamic matching

Given the user count is found by just counting the list, the following is sufficient.
my @strings = ( '8 changes by 4 users: user1 user2 user3 user4', '1 change by user1', ); for (@strings) { if (/^(\d+) change(?: by|s by \d+ users:) (.*)/) { my $changes = $1; my @users = split ' ', $2; print "changes=$changes, users=".@users.", list=@users\n"; } else { warn "Unrecognized string: $_\n"; } }
Outputs
changes=8, users=4, list=user1 user2 user3 user4 changes=1, users=1, list=user1
- Miller

Log In?
Username:
Password:

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

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

    No recent polls found