Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Regular Expression or RegEx in SQL Server 2005 Expand / Collapse
Author
Message
Posted Wednesday, February 4, 2009 4:00 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, January 15, 2014 5:07 PM
Points: 227, Visits: 192
Hi,

Can anyone give me an idea of how we configure and use "Regular Expressions"?

I want to use it for example:

select col1, col2, col3,EmailAddress
from Person.Contact
where dbo.RegExMatch('[a-zA-Z0-9_\-]+@([a-zA-Z0-9_\-]+\.)+(com|org|edu|nz|au)', EmailAddress) = 1

Questions:
1. Do we need to write any c# code and compile it as dll
2. Create a CLR proc?



Any inputs highly appreciated!!!

Thanks in advance,
Razi

http://www.questivity.com


Razi, M.
http://questivity.com/it-training.html
Post #650459
Posted Thursday, February 5, 2009 6:24 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 10:57 AM
Points: 10,387, Visits: 13,454
1. Yes, to the best of my knowledge you would need to develop a CLR function in C# or VB.
2. Yes, although you would want a function not a procedure.




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #650774
Posted Thursday, February 5, 2009 10:02 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, January 15, 2014 5:07 PM
Points: 227, Visits: 192
Hi Jack,

Thanks for the reply. Do you have any sample code or step by step procedures for this?

Regards,

Razi

http://www.questivity.com


Razi, M.
http://questivity.com/it-training.html
Post #651045
Posted Sunday, February 22, 2009 5:02 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, March 6, 2014 6:13 PM
Points: 318, Visits: 1,183
Razi,
There are a lot of examples on here - just search for "regex" and you'll find what you need. Matt Miller especially has provided samples:

http://www.sqlservercentral.com/Forums/Topic490684-149-1.aspx?Highlight=regex

Regards,

Jacob
Post #662307
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse