Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: qr// and user provided regex patterns...

by toolic (Bishop)
on Jul 30, 2009 at 13:09 UTC ( #784600=note: print w/replies, xml ) Need Help??


in reply to qr// and user provided regex patterns...

ikegami provided a solution to your direct question.

An alternate approach that I usually employ is to provide another command-line option for a case-sensitive match.

my $pattern = ($options{i}) ? qr/$options{c}/i : qr/$options{c}/;

The following does a case-sensitive match:

regexTester -c 'Bill Clinton'

The following does a case-insensitive match:

regexTester -i -c 'Bill Clinton'

See Finding commands in Unix PATH for a complete example with POD instructions.

Replies are listed 'Best First'.
Re^2: qr// and user provided regex patterns...
by misterMatt (Novice) on Jul 31, 2009 at 06:54 UTC
    Is there a graceful way to do this with a any combination of 3 flags?
      What is a any combination of 3 flags?
        i, m, s and x

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://784600]
help
Chatterbox?
[robby_dobby]: blogs.perl.org page for yapceu is out of date by 2 years
[robby_dobby]: LanX: Sharm-el-Sheikh is in Egypt
[choroba]: act.yapc.eu
[robby_dobby]: Thanks, choroba
[LanX]: yes and Egypt (like Turkey and Russia) belongs to two continents
[choroba]: Also Europe and Asia are geographically one continent, the division is political
[robby_dobby]: I always thought everything on the other side of Suez to be Africa. That's an entire continent
[LanX]: Sinai_Peninsula
[robby_dobby]: choroba: If you're talking of Eurasia, it's only true of the erstwhile Constantinople/ Ottoman empire
[LanX]: yes correct, but Sinai is not on the other side

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (15)
As of 2017-04-24 16:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (442 votes). Check out past polls.