Better regular expression for URLs

by Guillermo 31. October 2008 16:00

Via Jeff Attwood's post, in summary (because his posts tend to be very, hmm, thorough):

  • The primary improvement here is that we're only accepting a whitelist of known good URL characters. Allowing arbitrary random characters in URLs is setting yourself up for XSS exploits, and I can tell you that from personal experience. Don't do it!
  • We only allow certain characters to "end" the URL. Ending a URL in common punctuation marks like period, exclamation point, semicolon, etc means those characters will be considered end-of-hyperlink characters and not included in the URL.
  • Parens, if present, are allowed in the URL -- and we absorb the leading paren, if it is there, too.
  • The regular expression is:

    \(?\bhttp://[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]

    Tags: ,

    Development | Process & Methodology

    The perfect code comment

    by Guillermo 30. October 2008 22:00

    Via a dear friend of mine, this gem was made available for my enjoyment in all coincidence written the day of my birthday, and since being selfish is not in my nature I decided to share it with the five of you (literally).

    codeComments

    Tags: ,

    Development

    Framework 3.5 Enhancements (SP1) Training Kit

    by Guillermo 26. October 2008 22:18

    I love these as a quick, hands on way (my favorite) to get up to speed with skills and technology you may otherwise miss or take longer to catch up to.

    Here is the training kit from the horse’s mouth:

    The .NET Framework 3.5 Enhancements Training Kit includes presentations, hands-on labs, demos, and event materials. This content is designed to help you learn how to utilize the .NET 3.5 Enhancement features including: ASP.NET MVC, ASP.NET Dynamic Data, ASP.NET AJAX History, ASP.NET Routing, ADO.NET Data Services, ADO.NET Entity Framework, WCF 3.5 SP1, and the .NET Framework Client Profile.

    Download the kit from here.

    Tags: , , , , , ,

    Technology | Development | Process & Methodology

    Adopting a new base

    by Guillermo 26. October 2008 22:12

    for my age… and it will be officially the Hexadecimal base to define my age. 

    So today, I am 0x26!, yes 26 (hex).

    Tags:

    Random Thoughts | Off Topic

    Powered by BlogEngine.NET 1.5.0.7
    Theme by Extensive SEO

    About the author

    Something about the author

    Your Most Recent Comments

    Comment RSS

    Page List