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

Re^2: RegEx question

by vit (Friar)
on Dec 21, 2017 at 22:41 UTC ( [id://1206004]=note: print w/replies, xml ) Need Help??


in reply to Re: RegEx question
in thread RegEx question

Is it possible to write it without Pattern Modifiers? In other words without /sx

Replies are listed 'Best First'.
Re^3: RegEx question
by AnomalousMonk (Archbishop) on Dec 21, 2017 at 22:48 UTC

    Sure, just squish it all together (untested)
        /^(?:(?!bank).)*nova[ ]scotia(?:(?!bank).)*$/
    and remember that  . (dot) no longer "matches all." But why would you want to?

    Update: Actually, you no longer need the character class (update: because without  /x a space is a literal space):
        /^(?:(?!bank).)*nova scotia(?:(?!bank).)*$/
    and if you just gotta get rid of that last space:
        /^(?:(?!bank).)*nova\x20scotia(?:(?!bank).)*$/
    (both still untested).


    Give a man a fish:  <%-{-{-{-<

      Because I need it for both Perl and Java. Looks like this works, thank you very much !!!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-25 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found