in reply to Re: Re: Test if string is already quote()'d?
in thread Test if string is already quote()'d?

Seems like this could be a useful application of Text::Balanced...

I don't know if this helps, but anyway:

#!/usr/bin/perl -w use strict; use Text::Balanced qw( extract_quotelike ); for ( 'O\'Reilly, \'Tim\' "Timmy"', 'q # an octothorpe: \# (not the end of the q!) #', "'SELECT name FROM DUAL;'", ' "You said, \"Use sed\"." ', ) { my ($extracted, $remainder) = extract_quotelike; print "STRING: $_\n"; print " TOOK: $extracted\n"; print " LEFT: $remainder\n"; print " ERROR: $@->{error}\n" if $@; }
---
"A Jedi uses the Force for knowledge and defense, never for attack."