Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Force ASCII regexp for all perls 5.8+

by kcott (Chancellor)
on May 16, 2013 at 02:21 UTC ( #1033756=note: print w/replies, xml ) Need Help??


in reply to Force ASCII regexp for all perls 5.8+

G'day vsespb,

You could set up something like this just once:

my $d = qr{[0-9]}; my $w = qr{[A-Za-z0-9_]};

And then just use $w and $d instead of \w and \d. That gives you the added benefit of still having \w and \d available if you need them. Here's a minimal test:

$ perl -le ' my $w = qr{[A-Za-z0-9_]}; print q{With \x{424}:}; print 3+6 if "\x{424}" =~ /$w/; print q{With \x{42}:}; print 3+6 if "\x{42}" =~ /$w/; ' With \x{424}: With \x{42}: 9

-- Ken

Replies are listed 'Best First'.
Re^2: Force ASCII regexp for all perls 5.8+
by vsespb (Chaplain) on May 16, 2013 at 07:40 UTC
    Great idea!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033756]
help
Chatterbox?
Eily learned about Elsass
LanX doesnt care about orthografix
[LanX]: Eily: nit picking: Assurancetourix!
[karlgoethebier]: We also have Costa Nix
[Eily]: indeed
[LanX]: I like http://www.comedix .de/lexikon/db/ nihamavasah.php = never have we water and http://www.comedix .de/lexikon/db/ erindjah.php = Air India xD
[LanX]: work!
[LanX]: thats very strange, I try to change two columns to "unique" and MySQL is complaining even that the data is already unique ???

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2017-05-24 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?