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 isValidEmail2CLR_RegEx_Example_2008.zip
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:
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!