Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: \q quote-matching operator

by diotalevi (Canon)
on Aug 26, 2004 at 13:11 UTC ( #386001=note: print w/replies, xml ) Need Help??

in reply to \q quote-matching operator

You can add this yourself. See perlre at the end.

package Regexp::Quotes; use overload; sub import { shift; die "No argument allowed to Regexp::Quotes::import" if @_; overload::constant qr => \ &convert; } sub invalid { die "/$_[0]/: invalid escape '\\$_[1]'"; } my %rules = ( '\\' => "\\", 'q' => qr/[\'\" .... ]/ ); # Extend this sub convert { my $re = shift; $re =~ s( \\ ( \\ | q ) ) { $rules{$1} or invalid( $re, $1 ) }gex; $re; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://386001]
[hippo]: Congrats. I expect the resulting code to be rock solid. :)
[stevieb]: Thanks hippo, as do I, as if it's not, hardware peripherals or sensors could be destroyed (code has to be reliable when dealing with input/output voltages)
[hippo]: Aha - more Pi-based projects?

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (18)
As of 2017-01-20 16:50 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (176 votes). Check out past polls.