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. Web Development
  3. Javascript RX URL

Javascript RX URL

Scheduled Pinned Locked Moved Web Development
javascriptregexquestion
6 Posts 4 Posters 0 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hello everyone! Does anybody has a full RegEx in Javascript to test http urls? Tnx! Mariano, el estupefacto. :wtf: //TODO: Make this damn code work!

    A A 2 Replies Last reply
    0
    • L Lost User

      Hello everyone! Does anybody has a full RegEx in Javascript to test http urls? Tnx! Mariano, el estupefacto. :wtf: //TODO: Make this damn code work!

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      http://www.regexlib.com/[^] How do I print my voice mail?

      1 Reply Last reply
      0
      • L Lost User

        Hello everyone! Does anybody has a full RegEx in Javascript to test http urls? Tnx! Mariano, el estupefacto. :wtf: //TODO: Make this damn code work!

        A Offline
        A Offline
        Andrew Quinn AUS
        wrote on last edited by
        #3

        Try this fairly crude pattern match...

        (\s|\n|^)(\w+://[^\s\n]+)

        For future reference, visit www.regexlib.com[^] to see if someone has already done the leg-work. You can also test them @ http://www.regexlib.com/RETester.aspx[^] Hope this helps, Andy

        L 1 Reply Last reply
        0
        • A Andrew Quinn AUS

          Try this fairly crude pattern match...

          (\s|\n|^)(\w+://[^\s\n]+)

          For future reference, visit www.regexlib.com[^] to see if someone has already done the leg-work. You can also test them @ http://www.regexlib.com/RETester.aspx[^] Hope this helps, Andy

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Yes, thanks, I know the page, it has great RegExs, but I was looking foward for something more 'Standard', like from w3.org, or IEEE, or so. Because that expression isn't at all accurate for the use I want to give to it. For example: http://HelloMyNameIsMariano matches with it. I'm looking for expression for Internet URL Addresses. Thanks anyway. What I'm doing now is a System.Net.WebRequest, that way I can be sure the address is good and exists! Bye!!! Mariano, el estupefacto. :wtf: //TODO: Make this damn code work!

          J 1 Reply Last reply
          0
          • L Lost User

            Yes, thanks, I know the page, it has great RegExs, but I was looking foward for something more 'Standard', like from w3.org, or IEEE, or so. Because that expression isn't at all accurate for the use I want to give to it. For example: http://HelloMyNameIsMariano matches with it. I'm looking for expression for Internet URL Addresses. Thanks anyway. What I'm doing now is a System.Net.WebRequest, that way I can be sure the address is good and exists! Bye!!! Mariano, el estupefacto. :wtf: //TODO: Make this damn code work!

            J Offline
            J Offline
            J4amieC
            wrote on last edited by
            #5

            |/| / |Z ! / || [] wrote: good and exists A regex may tell you if its syntactically good, but it wont tell you that it exists :confused:

            L 1 Reply Last reply
            0
            • J J4amieC

              |/| / |Z ! / || [] wrote: good and exists A regex may tell you if its syntactically good, but it wont tell you that it exists :confused:

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              What I meant is that you can evaluate "http://www.thisaddressdoesnotexists.com" and it will work fine. But with the WebRequest you'll have an URINotFoundException. See what I'm saying? Regex wont test if it exists on the web, but WebRequest will. That's what I tried to say. Mariano, el estupefacto. :wtf: //TODO: Make this damn code work!

              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