Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^4: Regex Help

by Anonymous Monk
on Mar 28, 2013 at 07:56 UTC ( #1025885=note: print w/replies, xml ) Need Help??

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

Thanks 2Teez. That was clear & fine... :)

Replies are listed 'Best First'.
Re^5: Regex Help
by hdb (Prior) on Mar 28, 2013 at 08:26 UTC

    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

      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://1025885]
[stevieb]: I'm learning that no matter how good a piece of software is at what it's supposed to do, it's a piece of shit without providing any API documentation. (Talking about C++ here currently). Seriously... write software for an embedded platform and make...
[stevieb]: guess based on the sparse examples, and the header files that are spread out illogically?
[stevieb]: document the public facing functions/methods people... ALL OF THEM.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2017-05-28 23:43 GMT
Find Nodes?
    Voting Booth?