|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 4:13 PM
Points: 2,766,
Visits: 1,442
|
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Monday, February 18, 2013 6:53 AM
Points: 60,
Visits: 122
|
|
Very nice Article.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 4:44 PM
Points: 26,
Visits: 86
|
|
Although RegEx is powerful, I have tried using it once and found that coding my own CLR function to manipulate strings to what I want was 100 times faster than the RegEx function was.
If you are running the code against a small dataset this should not matter however I was running the code against millions of rows and this had a major impact on performance.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 10:05 PM
Points: 33,112,
Visits: 27,039
|
|
Great and very nicely put together article, David. My hat is off to you. But what of performance? Have you done any comparisons between the Regex function and a moderately complex PatIndex?
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 10:05 PM
Points: 33,112,
Visits: 27,039
|
|
david.rowland (5/7/2012) Although RegEx is powerful, I have tried using it once and found that coding my own CLR function to manipulate strings to what I want was 100 times faster than the RegEx function was.
If you are running the code against a small dataset this should not matter however I was running the code against millions of rows and this had a major impact on performance.
What did your custom CLR do to beat Regex so soundly?
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 4:51 PM
Points: 135,
Visits: 220
|
|
I've used our own in-house implementations of some of the .Net RexEx functions on seemingly large datasets (several million records each), mostly to help clean up, validate and parse addresses, city-state-zip (or province), etc.
Beats pure SQL functions like Hulk did to Loki in the movie, especially in understandability. I'll take teasing a complicated Rexex pattern over scads of nested SQL functions trying to do the same thing.
one I really have done lots of is to do is keep expanding on a pattern like this: '(Company|corp|corporation|inc|llp|llc...)'
beats continuing to add "or field like '%new_match%' ..."
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: 2 days ago @ 3:39 AM
Points: 3,
Visits: 36
|
|
RegEx is Thee best tool in order to find any pattern within given string[did couple of test including .Net String manipulation and limited RegEx in SQL , Like/PATIndex....], and it proves to be much faster than any other way. in regards to good editor, try this one: http://www.ultrapico.com/Expresso.htm moreover, consider using FullText indexing from time to time, as it might even ease searching for Words other than using RegEx.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 1:22 AM
Points: 2,
Visits: 34
|
|
| If you use regex combined with a where clause it can not use the index anymore. I think this is very important.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, January 22, 2013 8:13 AM
Points: 1,
Visits: 12
|
|
| Am I out of line in thinking this is something that should be handled in a high-level object-oriented language?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 8:24 AM
Points: 1,272,
Visits: 4,309
|
|
| I'm not particularly familiar with the CLR--does processing stuff via RegEx in this way effectively mean you're using RBAR, or is it a bit cleverer than that?
|
|
|
|