Click here to get back home

RE Perl Pattern matching

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
RE Perl Pattern matching Deepan Perl XML Parser 04-02-2008
Posted by Deepan Perl XML Parser on April 2, 2008, 1:23 am
Please log in for more thread options
Hi,
I am having a string say $str, the value of it is as
below:

<responseStatus>HTTP/1.1 200 OK</responseStatus>

                <cookies>

                        <cookie name="ASPSESSIONIDSQDCBDBA" path="/" domain="www-
int.juniper.net">DOCFGJEAKNOMBLHCGEMOIMBA</cookie>

                </cookies>

                <headers>

                        <header name="Cache-control">private</header>

                        <header name="Content-Encoding">deflate</header>

                        <header name="Content-Type">text/html</header>

                        <header name="Date">Wed, 26 Mar 2008 04:48:16 GMT</header>

                        <header name="Server">Concealed by Juniper Networks Redline EX</
header>

                        <header name="Set-
Cookie">ASPSESSIONIDSQDCBDBA=DOCFGJEAKNOMBLHCGEMOIMBA; path=/</header>

                        <header name="Transfer-Encoding">chunked</header>

                        <header name="Vary">Accept-Encoding, User-Agent</header>

                        <header name="Via">1.1 sac-p-green-dx2 (Juniper Networks
Application Acceleration Platform - DX 5.1.8 0)</header>

                        <header name="Warning">214 www-int.juniper.net &quot;Juniper
Networks DX Active&quot;</header>

                        <header name="X-Powered-By">ASP.NET</header>

                </headers>

                <content>

                        <contentLength>27887</contentLength>

                        <compression>71.3</compression>

                        <encodingScheme>deflate</encodingScheme>

                        <text><![CDATA[
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"..."http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">..<html>..<head>....<title>
Intranet Home Page</title>..<script language="JavaScript" type="text/
javascript">..function clicker()..{..document.seek2.qt.value =
document.seek1.qt.value;..return true;..}</form>.. <!-- close Main2 --
>..</div><!-- close Main1 -->....</body>..</html>..
]]></text>

                        <mimeType>text/html</mimeType>

                </content>

----------------

Now i want to get everything between "<text><![CDATA[" and "]]></
text>" [ie i need to capture the CDATA section]and i am using the
below code

if( $str =~ m#<text><!\[CDATA\[(.*)\]\]></text># )
{
        print $1;
}


But not getting anything. Can anyone find out the fault in it?

Similar ThreadsPosted
Help with Pattern matching. Matching multiple lines from while reading from a file. May 2, 2007, 11:37 pm
perl pattern matching August 31, 2004, 8:57 am
perl pattern matching March 12, 2005, 8:25 am
Pattern matching in perl August 10, 2006, 9:25 am
Perl pattern matching and extraction March 8, 2008, 8:48 am
[perl-python] string pattern matching February 1, 2005, 1:45 pm
How to do pattern matching for multiple files in Perl August 28, 2007, 9:23 am
[perl-python] text pattern matching, and expressiveness February 7, 2005, 12:00 pm
Pattern Matching December 15, 2004, 10:51 am
[PATTERN MATCHING] December 17, 2004, 12:14 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap