Email validate

by Svelmoe 12. September 2007 13:57

This is a semi-strong validation of e-mails for danish national characters as well. It is not perfect, but decent if needing a solid validating of an email, and I am constantly updateing it for personal use.

Note: Beware of the line breaks added

 ^[0-9a-zA-ZæøåÆØÅ][\w\.\-_æøåÆØÅ]*[a-zA-Z0-9æøåÆØÅ\.\-]@
a-zA-Z0-9æøåÆØÅ]([\w\.\-_æøåÆØÅ][a-zA-Z0-9æøåÆØÅ])*\.
[a-zA-ZæøåÆØÅ][a-zA-ZæøåÆØÅ\.]*[a-zA-Z]$


Yes, I know it is (far) from perfect, but it works for some of the reasons I encounter.
Also - remember, sometimes a loose validation is much better, if you can't validate completely - however, there are times where a stronger, more restrictive validation is useful.

 

At least for me :) 

Numbers in regular expression.

by Svelmoe 23. August 2007 14:04

Made these regular expressions some time ago to parse/validate numbers in text.

Validate number with comma as decimal pointer, and period as group separator:
^(\d+|([1-9]|[1-9]\d|[1-9]\d{2})(\.\d{3})*)(,\d{1,2})?$

Validate number with period as decimal pointer and comma as group separator:
^(\d+|([1-9]|[1-9]\d|[1-9]\d{2})(,\d{3})*)(\.\d{1,2})?$


Hope they are useful.

 

About Svelmoe

My real name is Allan Svelmøe Hansen.

I live in Denmark, where I work as a developer for hedal:kruse:brohus using SQL Server and the .NET framework since 2004. Svelmoe.dk is a place for my every day thoughts and reactions and the occasional technical blog entry.

I also blog about SQL and MS SQL Server at www.execsql.com so in case you are looking for more about that, please visit that website.



View Allan Svelmøe Hansen's profile on LinkedIn     

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010 Svelmoe.dk