Regex expresion in MS SQL
        Posted  
        
            by adopilot
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by adopilot
        
        
        
        Published on 2010-03-10T11:46:40Z
        Indexed on 
            2010/03/26
            14:43 UTC
        
        
        Read the original article
        Hit count: 628
        
I do not not know much about Regex, I want to try parsing sting from database according to flowing instructions. I know that I am need to use CLR but for begin I want to learn Regex
Data in tables look like
create table #tempTBL (opis varchar(40))
go
insert into #tempTBL
select 'C 136'
union 
select 'C 145'
union 
select 'C146'
union 
select 'AK C 182'
union 
select 'C  277'
union 
select 'C-240'
union 
select 'ISPRAVKA PO C 241'
And select sting looks like
Select 
     reverse(
            rtrim(
                    ltrim(
                            replace(
                                    (substring
                                            (reverse(opis)
                                                    ,0
                                                    ,charindex(
                                                                'C',reverse(opis)
                                                               )
                                            )
                                      )
                            ,'-',' ')
                          )
                  )
            ) as jci
from #tempTBL
How should looks like my C# code to I repeat this using regex
© Stack Overflow or respective owner