troubleshooting Question

Regular expression in SQL select/update statement

Avatar of SQLUser212
SQLUser212 asked on
Microsoft SQL ServerRegular Expressions
8 Comments1 Solution2079 ViewsLast Modified:
Trying to write like regular expression in SQL select/update staements to get the values that look like any of these [“H6P.5“,“Z3C.10“,“D1V.1222“] where
1.       the first character is an upper or lower case letter
2.       followed by anything in between then a period
3.       followed by matching the any set of repeating numbers, i.e. 12+ matches 122, 1222, and so on.

I tried this
select * from table1 WHERE ID LIKE  '[A-Za-z]%.[0-9]%', but it also gets the values like H6P.5H, D1V.1JJ

I also tried this LIKE '[A-Za-z]%.[0-9]#', '[A-Za-z]%.[0-9]+', '[A-Za-z]%.[0-9]@', '[A-Za-z]%.[0-9]*' but won't get any values.

Please suggest.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros