Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. RegularExpressions in SQL Server

RegularExpressions in SQL Server

Scheduled Pinned Locked Moved Database
databasesql-serversysadminhelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    indian143
    wrote on last edited by
    #1

    Hi, I need regular expressions in SQL Server for two things 1. Get the first 3 characters from a string, no matter alphabets or numerical values but not special characters, like for example if I have file name A00Temp then it should give me A00 and if the string is _A00Temp then still it should give me the A00 only but not _A0, if it has ABCTemp then it should give me ABC 2. the 2nd need is if I have a string with alphabets, numerical and special characters then it should give me only alphabets from that string for exmple if I have: Abc def 230 then I should get abcdef, if I the string is _abc$#def then I should get only abcdef. If I can do this using regular expressions, please help me, any type of help is very welcome, thanks in advance.

    Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

    L Richard DeemingR 2 Replies Last reply
    0
    • I indian143

      Hi, I need regular expressions in SQL Server for two things 1. Get the first 3 characters from a string, no matter alphabets or numerical values but not special characters, like for example if I have file name A00Temp then it should give me A00 and if the string is _A00Temp then still it should give me the A00 only but not _A0, if it has ABCTemp then it should give me ABC 2. the 2nd need is if I have a string with alphabets, numerical and special characters then it should give me only alphabets from that string for exmple if I have: Abc def 230 then I should get abcdef, if I the string is _abc$#def then I should get only abcdef. If I can do this using regular expressions, please help me, any type of help is very welcome, thanks in advance.

      Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      See RegExr: Learn, Build, & Test RegEx[^].

      1 Reply Last reply
      0
      • I indian143

        Hi, I need regular expressions in SQL Server for two things 1. Get the first 3 characters from a string, no matter alphabets or numerical values but not special characters, like for example if I have file name A00Temp then it should give me A00 and if the string is _A00Temp then still it should give me the A00 only but not _A0, if it has ABCTemp then it should give me ABC 2. the 2nd need is if I have a string with alphabets, numerical and special characters then it should give me only alphabets from that string for exmple if I have: Abc def 230 then I should get abcdef, if I the string is _abc$#def then I should get only abcdef. If I can do this using regular expressions, please help me, any type of help is very welcome, thanks in advance.

        Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        SQL Server doesn't have built-in regular expression support, but you can add it with SQLCLR: GitHub - DevNambi/sql-server-regex: Run regular expressions in SQL Server[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups