[Linux-disciples] Perl: displaying the part of a match that failed

Stephen R Laniel steve at laniels.org
Fri Jun 24 13:48:09 EDT 2005


As I mentioned, I'm writing a hackish little CSS parser,
using regular expressions to encode the grammar -- e.g.,
something like

my $block = qr/$openBrace\s*${statement}\s*$closeBrace/;
my $statement = qr/${property}\s*:\s*$value;/;
etc.

If a stylesheet file doesn't match the regex, I'd like Perl
to display for me the part of the file that failed to match.
Is this possible?

-- 
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20050624/ba37424a/attachment.pgp


More information about the Linux-disciples mailing list