Need one Regular Expression - Urgent

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lucky

    #1

    Need one Regular Expression - Urgent

    hi guys,
    i'm looking for one RegEx which can find matches from the bunch of
    lines. i want to find all the matches of "<a * href=*>*</a>". if any
    one can help me out here, please do come forward.


    thanks,
    Lucky

  • Cor Ligthert [MVP]

    #2
    Re: Need one Regular Expression - Urgent

    Lucky,

    If you have a reply, pleas, don't than split it up between more messages.
    Reply to yourself with the addition.

    Cor


    Comment

    • Siva M

      #3
      Re: Need one Regular Expression - Urgent

      You might want to check at www.regexlib.com

      "Lucky" <tushar.n.patel @gmail.com> wrote in message
      news:1135835347 .197739.221860@ g47g2000cwa.goo glegroups.com.. .
      hi guys,
      i'm looking for one RegEx which can find matches from the bunch of
      lines. i want to find all the matches of "<a * href=*>*</a>". if any
      one can help me out here, please do come forward.


      thanks,
      Lucky


      Comment

      • Homer J Simpson

        #4
        Re: Need one Regular Expression - Urgent


        "Lucky" <tushar.n.patel @gmail.com> wrote in message
        news:1135835347 .197739.221860@ g47g2000cwa.goo glegroups.com.. .
        [color=blue]
        > hi guys,
        > i'm looking for one RegEx which can find matches from the bunch of
        > lines. i want to find all the matches of "<a * href=*>*</a>". if any
        > one can help me out here, please do come forward.[/color]

        "\<a * href=*\>*\</a\>" in MSWord

        "\<a .* href=.*\>.*\</a\>" in Unix IIRC. Be aware this won't find "<a *
        Href=*>*</A>"

        VB Net may differ.



        Comment

        • kevin  cline

          #5
          Re: Need one Regular Expression - Urgent

          In the general case this can not be done with regular expressions,
          because the <a> element can contain markup itself. You need an HTML
          parser for this problem. As far as I can tell Microsoft is of no help
          here. If you can consider other languages, there are well-tested
          solutions for Perl, Python, and Ruby. For C# I found this link:


          Comment

          • Kevin Spencer

            #6
            Re: Need one Regular Expression - Urgent

            (?i)<(a{1}?)[^>]*href=[^>]*[>]?(.*?)(?:</\1|/)>{1}?

            --
            HTH,

            Kevin Spencer
            Microsoft MVP
            ..Net Developer
            You can lead a fish to a bicycle,
            but it takes a very long time,
            and the bicycle has to *want* to change.

            "Homer J Simpson" <nobody@nowhere .com> wrote in message
            news:qW1tf.1434 1$6K2.14268@edt nps90...[color=blue]
            >
            > "Lucky" <tushar.n.patel @gmail.com> wrote in message
            > news:1135835347 .197739.221860@ g47g2000cwa.goo glegroups.com.. .
            >[color=green]
            >> hi guys,
            >> i'm looking for one RegEx which can find matches from the bunch of
            >> lines. i want to find all the matches of "<a * href=*>*</a>". if any
            >> one can help me out here, please do come forward.[/color]
            >
            > "\<a * href=*\>*\</a\>" in MSWord
            >
            > "\<a .* href=.*\>.*\</a\>" in Unix IIRC. Be aware this won't find "<a *
            > Href=*>*</A>"
            >
            > VB Net may differ.
            >
            >
            >[/color]


            Comment

            • Homer J Simpson

              #7
              Re: Need one Regular Expression - Urgent


              "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
              news:un$lbqUDGH A.688@TK2MSFTNG P11.phx.gbl...
              [color=blue]
              > (?i)<(a{1}?)[^>]*href=[^>]*[>]?(.*?)(?:</\1|/)>{1}?[/color]

              Not bad, but a{1} is redundant



              Comment

              Working...