regex

  • Does tsql have something similar to regex?

  • PATINDEX, LIKE and CHARINDEX can all be used to simulate regex.

    There's an article on CLR implementations here[/url], with further discussion in the discussion section (which I still intend to go back to at some point, but have been without the time recently).


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Thank you.

  • Cadavre (7/4/2012)


    PATINDEX, LIKE and CHARINDEX can all be used to simulate regex.

    There's an article on CLR implementations here[/url], with further discussion in the discussion section (which I still intend to go back to at some point, but have been without the time recently).

    Be really sure to read the discussions attached to that article. Neither SQL# nor REGEX is all that it's cracked up to be. The discussions basicly lead you to one conclusion... if it can be done using LIKE, PATINDEX, and CHARINDEX in T-SQL, there's a very high probability that it will be faster than going outside the proverbial box.

    --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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply