in reply to storing a qr// compiled regexp in a database?
There's one other issue to beware, if you're trying to persist the stringified version of qr// objects: regex creep.
The stringifier and the qr// operator don't bother to collapse all of the redundant or unnecessary buildup of those (?-xism:...) wrappers. You could get a massive hundred-layer wrapper if you carelessly freeze and thaw these objects.$regex = qr/(this)is[a]test/i; $regex = "$regex"; $regex = qr/$regex/; # simulate freeze/thaw cycle $regex = "$regex"; $regex = qr/$regex/; # simulate freeze/thaw cycle $regex = "$regex"; $regex = qr/$regex/; # simulate freeze/thaw cycle print "regex: qr{$regex}\n"; __OUTPUT__ regex: qr{(?-xism:(?-xism:(?-xism:(?i-xsm:(this)is[a]test))))}
--
[ e d @ h a l l e y . c c ]
|
|---|