Loading ...
Sorry, an error occurred while loading the content.

regex

Expand Messages
  • balachandarb_2002
    Hi All, I little bit struggling in writing regex for the following xml stream. I use scalar variable to store the stream. Input:-
    Message 1 of 3 , Jan 14, 2008
    • 0 Attachment
      Hi All,
      I little bit struggling in writing regex for the following xml stream.
      I use scalar variable to store the stream.

      Input:-
      <branding><pl>AAAA</pl><pn>bbbb</pn></branding>
      <branding><pl>CCCCC</pl><pn>dddd</pn></branding>

      I want output like the following one:-
      <branding<pn>bbbb</pn><pl>AAAA</pl></branding>
      <branding><pn>dddd</pn><pl>CCCCC</pl></branding>

      pls. anybody show light on this.

      Thanks in Advance
      Balachandar. B
    • merlyn@stonehenge.com
      ... balachandarb I little bit struggling in writing regex for the following xml stream. Yes. Don t use regex to parse XML. You *should* be struggling. :)
      Message 2 of 3 , Jan 14, 2008
      • 0 Attachment
        >>>>> "balachandarb" == balachandarb 2002 <balachandarb_2002@...> writes:

        balachandarb> I little bit struggling in writing regex for the following xml stream.

        Yes. Don't use regex to parse XML. You *should* be struggling. :)

        There are many modules in the cpan to do XML parsing, in three
        major categories:

        classic items linking to the expat library (first coded by Larry!)
        modern items using the Gnome libxml2
        a few oddballs that use regex that were written by people who had
        far more time than you did to get it right. :)

        What you want is up to you.

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
      • balachandarb_2002
        Hi, Late Thanks for your reply. b coz of some urgent work I went off from office. I follow your advice and let me know if I found any problem. Balachandar. B
        Message 3 of 3 , Jan 18, 2008
        • 0 Attachment
          Hi,

          Late Thanks for your reply. b'coz of some urgent work I went off
          from office. I follow your advice and let me know if I found any
          problem.

          Balachandar. B


          --- In perl-beginner@yahoogroups.com, merlyn@... wrote:
          >
          > >>>>> "balachandarb" == balachandarb 2002 <balachandarb_2002@...>
          writes:
          >
          > balachandarb> I little bit struggling in writing regex for the
          following xml stream.
          >
          > Yes. Don't use regex to parse XML. You *should* be struggling. :)
          >
          > There are many modules in the cpan to do XML parsing, in three
          > major categories:
          >
          > classic items linking to the expat library (first coded by
          Larry!)
          > modern items using the Gnome libxml2
          > a few oddballs that use regex that were written by people
          who had
          > far more time than you did to get it right. :)
          >
          > What you want is up to you.
          >
          > --
          > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
          777 0095
          > <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
          > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
          > See PerlTraining.Stonehenge.com for onsite and open-enrollment
          Perl training!
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.