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

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on Need to write a regular expression in perl for the below xml code.

Replies are listed 'Best First'.
Re: Need to write a regular expression in perl for the below xml code.
by CountZero (Bishop) on Apr 21, 2011 at 16:10 UTC
    Your question is not detailed enough to give you any meaningful answer.

    What exactly do you want to do?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Need to write a regular expression in perl for the below xml code.
by ww (Archbishop) on Apr 21, 2011 at 16:10 UTC
Re: Need to write a regular expression in perl for the below xml code.
by Anonymous Monk on Apr 21, 2011 at 16:28 UTC
Re: Need to write a regular expression in perl for the below xml code.
by davido (Cardinal) on Apr 21, 2011 at 17:23 UTC

    My response is directed toward your subject line for this post, as the content of the post doesn't ask a question, or even put forth a need.

    You said you need to write a regular expression in Perl for XML code. All I can contribute to such a vague statement of design specification is that, having used XML to some extent, I haven't ever had to write a regular expression to parse XML. That's not to say regular expressions aren't used in the course of XML parsing with Perl, but they're generally encapsulated in modules that do the heavy lifting for you. The advantage to such modules is that they're well thought out, refined, heavily tested, and have passed through the hot forge of large user-bases.

    You can write your own XML parser if you wish. But when General Motors builds a car, they don't boil the rubber out of trees from the Amazon to make their tires. In fact, they don't even make tires; they buy them from a supplier who has more experience in that specific aspect of manufacturing. GM could, if they wanted to, manufacture their own tires. But they've realized that it's beneficial to let an expert handle that detail for them.

    I recommend you have a look at a few of the following CPAN modules: XML::Twig, XML::Simple, XML::LibXML::Parser... there are many others well tested and highly thought of. But these cover a broad array of needs. Yes, even you can use CPAN. If you're on ActiveState Perl, look at PPM to see what it has to offer for XML modules. If you're on a kinder flavor of Perl (Strawberry, or most Linux environments), it's as easy as typing "cpan install module::name."


    Dave

Re: Need to write a regular expression in perl for the below xml code.
by Utilitarian (Vicar) on Apr 21, 2011 at 16:11 UTC
    Please use code tags and ask questions
    What do you want to do ?
    print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."