in reply to Defining your own regex character class
I don't know about custom POSIX syntax, but you can define your own Unicode properties. See perlunicode for the gory details.
If your Perl is at least 5.10, you can define your own matches of any sort (not just character classes) using the (?(DEFINE)...) construction:
$x =~ m/( (?&DIGIT)+ ) (?(DEFINE) (?<DIGIT>:[0-9]) ) /smx
Note that the above example is the coldest of cold code. This is documented in perlre. That document also has a section on creating custom RE engines, but the second sentence of the section is "This is not for the faint of heart."
|
|---|