in reply to Regex from a string

You're looking for qr//.

Note: what you're trying to can be a really bad thing. The reason is because regexes can theoretically execute arbitrary Perl code using the (?{...}) construct. Now, use re 'eval'; has to be in effect, but if that gets put in by a maintenance programmer later, you're in trouble.

Update: Link to apparently pirated material removed.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Replies are listed 'Best First'.
Re^2: Regex from a string
by ghenry (Vicar) on Jun 17, 2005 at 14:57 UTC

    Shame on you dragonchild for linking to pirate O'Reilly books.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!
      Ug. That's the exact same site that got me recently, too.. A quick google search on this topic found it very high in the results here, too..

        Yeah, we discussed this in April in Links to copyrighted material

        Walking the road to enlightenment... I found a penguin and a camel on the way.....
        Fancy a yourname@perl.me.uk? Just ask!!!