Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
No such thing as a small change
 
PerlMonks  

Re^3: can any reply out with a better code than this??

by fenLisesi (Priest)
on Dec 06, 2007 at 07:53 UTC ( #655303=note: print w/ replies, xml ) Need Help??


in reply to Re^2: can any reply out with a better code than this??
in thread can any reply out with a better code than this??

Sorry, asdfghjkl, I confused you by changing the string. Try running it with ri\d+ri\d+ri\d+ for a match. That was meant to emphasize the use of \Q...\E.


Comment on Re^3: can any reply out with a better code than this??
Select or Download Code
Re^4: can any reply out with a better code than this??
by asdfghjkl (Initiate) on Dec 06, 2007 at 07:57 UTC
    can u suggest me a code from taking both the things from terminal itself....can i print out the matched content with my code properly.i had justed tested out for a few cases like calling some files.etc.......whether it would work for any case like that so that it need to match 3 consecutive times as per the contents of $string
      Do you mean something like this?
      use strict; my $string = 'ri\d+'; while (my $line = <>) { if ($line =~ m{ ( ( \Q$string\E ){3} ) }xms) { print $line; printf qq{\tMatched "$2" x 3: "$1"\n}; } }

      Why don't you post a little more of your code "calling some files"?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-04-16 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (414 votes), past polls