Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Regular Expressions
  4. Regex to detect href not correctly closed

Regex to detect href not correctly closed

Scheduled Pinned Locked Moved Regular Expressions
regexquestioncareer
3 Posts 2 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_15199879
    wrote on last edited by
    #1

    Sorry, do you suggest me a regex to find in a page not properly closed href tags, like this?

    In practice, the final ">" is missing. Can you suggest a regex that can detect this? Thanks and good job ;)

    Richard DeemingR 1 Reply Last reply
    0
    • M Member_15199879

      Sorry, do you suggest me a regex to find in a page not properly closed href tags, like this?

      In practice, the final ">" is missing. Can you suggest a regex that can detect this? Thanks and good job ;)

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Regex is not really the right tool to be parsing HTML. However, it's fairly simple to detect unbalanced angle brackets:

      <[^>]*(<|$)

      Regexper[^] Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      M 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Regex is not really the right tool to be parsing HTML. However, it's fairly simple to detect unbalanced angle brackets:

        <[^>]*(<|$)

        Regexper[^] Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        M Offline
        M Offline
        Member_15199879
        wrote on last edited by
        #3

        Ok Richard, thaks a lot ;)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups