OK here's a starter kit for you in C# for SQL2008.
the usual caveats about downloading strangers code and all that applies, obviously.
don't deploy code you don't fully understand, and only deploy this to your developer testing server/database until you are sure of it.
here is a 2008 Project, all zipped up with both my example and my friend Sean Lange's example, named IsValidEmail1 and isValidEmail2
you need to change the database connection of the project to point to your own server/database: mine was dev223/SandBox:
if you get a deployment error, it might be becasue the database needs to be set to trustworthy:
ALTER DATABASE SandBox SET TRUSTWORTHY ON;
after you change that, you want to build the project , then deploy the project from the VS2008 Build...Build SQLServerProject2 menu item.
testing a scalar function like this is a simple TSQL command:
select
dbo.IsValidEmail1('lowell.someplace'),
dbo.IsValidEmail2('lowell.someplace')
select
dbo.IsValidEmail1('lowell@somplace.com'),
dbo.IsValidEmail2('lowell@somplace.com')
Lowell