sugarkannan has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I require your guidance for the
following problems. Any suggestions are appreciated.
1.I have this following piece of , but I am unable to
get the required chunk of data i.e. the values between
<br>color="BA3B38"> and </td></tr>. But I am unable to get
past the first <br> in the first line. I tried
removing \n using translation $content =~ tr\n[]d;
but still program didn't work.
This is my Chunk of data :

$content='<td valign="top" align="justify"><font face="arial" size="2" + color="BA3B38">Java and databases make a powerful combination. <br> Getting the two sides <br> to work together <br> Takes some effort to work together JDBC 2 javax.SQL </td></tr>';
Following is my REGEX code :
$content =~ m /<td valign=\"top\" align=\"justify\"><font face=\"arial" size=\"2\" color=\"BA3B38\">(.*?)<\/td><\/tr>/mg
I tried using mg parameter for traversing multiple lines & global search but it didn't work.
I expect the following output but I'm not able to get any output.
Java and databases make a powerful combination. <br> Getting the two s +ides <br> to work together <br> Takes some effort to work together JDBC 2 javax.SQL

---------------------
-Sugar

Replies are listed 'Best First'.
Re: Problem with Regular Expressions
by Samy_rio (Vicar) on Nov 19, 2005 at 12:41 UTC

    Hi sugarkannan, Use 's' Option Modifier.

    print $content =~ m /<td valign=\"top\" align=\"justify\"><font face=\ +"arial" size=\"2\" color=\"BA3B38\">(.*?)<\/td><\/tr>/mgs; __END__ Java and databases make a powerful combination. <br> Getting the two sides <br> to work together <br> Takes some effort to work together JDBC 2 javax.SQL

    Regards,
    Velusamy R.


    eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';

      Thanks a lot.. It worked.. Regards, SK