Regular expressions

Discussion in 'Programming' started by Help Desk, Mar 8, 2006.

  1. #1
    In Visual Studio, their default Internet URL regular expression ...
    ...does not account for tildes. I believe the following will work...
    Does that look right?
     
    Help Desk, Mar 8, 2006 IP
  2. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The best idea, (well what i always do), is i make a file or a script or a program, which lets me test my expression. And i change it, when the program/script doesn't display the correct thing i was looking for. You will be amazed at how many mistakes you make.
     
    execute, Mar 8, 2006 IP
    Help Desk likes this.
  3. lemming

    lemming Peon

    Messages:
    13
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Depending on what language you're using I would just try to find a library that is already doing it for you. Why re-invent the wheel. In Java, I just try to create URL object and see if it throws an exception. For Perl, there's Regexp::Common. In PHP, parse_url helps, but I don't think it's considered a true validator.

    Off the top of my head, it looks like the expression is missing ",:+#;@$". I'm probably missing other stuff too. Not sure about !^()<>'"\ for example.
     
    lemming, Mar 9, 2006 IP