You can store a reference to a regular expression using
qr// (see
Regexp Quote Like Operators). The stringified version of that will store easily in a database, and can be bound like any other regular expression with
$text =~ $regex (see
Binding Operators) or interpolated into other expressions, a la
m/^$regex$/.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.