On Tue, 2008-09-23 at 14:05 -0700, Darren Nay wrote: > Here is the string: > <xsl:output method="html" encoding="utf-8" indent="yes" > doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" /> > > Now, I want to match against that string and retrieve the value of > doctype-system. I am doing the following.. > > $contents =~ m/doctype-system="(.*)"/i; > $dtd_system = $1; > > This works, except that I am getting the value of everything between > the 1st quotes and the last quotes on the line (after doctype-public).
$contents =~ m/doctype-system="(.*?)"/i; You could also use: m/doctype-system="([^"]*)"/i The best method would be to use a XML parser and record the attribute 'doctype-system' of the element 'xsl:output'. Some parsers available from CPAN <http://search.cpan.org/> are XML::Twig XML::SAX and XML::DOM -- Just my 0.00000002 million dollars worth, Shawn Linux is obsolete. -- Andrew Tanenbaum -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/