Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Regular Expression: search two times for the same number of any signs

by tybalt89 (Monsignor)
on Nov 29, 2016 at 15:31 UTC ( [id://1176827]=note: print w/replies, xml ) Need Help??


in reply to Regular Expression: search two times for the same number of any signs

#!/usr/bin/perl # http://perlmonks.org/?node_id=1176775 use strict; use warnings; print /x(.*)x(??{$1 =~ tr##.#cr})x/ ? 'pass' : 'fail', ' ', $_ while < +DATA>; __DATA__ xxxxx x1x2x...x xxx x.x.x x12x..x x123x...x x123x.x.x x12x1x

outputs:

pass xxxxx pass x1x2x...x pass xxx pass x.x.x pass x12x..x pass x123x...x pass x123x.x.x fail x12x1x

Log In?
Username:
Password:

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

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

    No recent polls found