Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^5: Regex Help

by hdb (Monsignor)
on Mar 28, 2013 at 08:26 UTC ( #1025892=note: print w/replies, xml ) Need Help??

in reply to Re^4: Regex Help
in thread Regex Help

How about "everything from pirates to careebian" ? ;-)

use strict; use warnings; while(<DATA>){ chomp; print $1,$/ if /(pirates.*careebian)/; } __DATA__ piratesofcareebian100 pirates of careebian100 pirates of careebian 100 pirates1 of careebian 100 pirates2 of careebian 100 pirates3 of careebian 100

Replies are listed 'Best First'.
Re^6: Regex Help
by Anonymous Monk on Mar 28, 2013 at 19:00 UTC

    How about "everything from pirates to careebian" ?
    But what about if the wording of the OP changes? Then your solution would no longer be useful.

      Correct! He would need to change the regular expression. But then I was not completely serious in my reply... (even though it works!)

      One could also use variables in the regex like /($from.*$to)/.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025892]
[LanX]: simple recursive function which goes left and right till l or r are exhausted
LanX #solved
[oiskuu]: I must watch Police Academy again sometime.
[Discipulus]: thanks all
[LanX]: ?

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-03-19 11:26 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (239 votes). Check out past polls.