SQL Server : Regular Expression in Like -


i'm having trouble getting regular expression work in sql server.

i take in comma separated list, each item string want match against.

declare @list table ([searchtext] varchar(255)) insert @list ([searchtext]) select cast(item varchar) dbo.fnsplit(@ids, ',')  update @list set  searchtext = '%controller/action/' + searchtext + '%' 

then need find if match in tables.

select id table1 t1 inner join @list l on t1.[url] l.searchtext 

the problem match 'controller/action/283' , 'controller/action/2834'

so tried '%controller/action/' + searchtext + '[^0-9]%' , works. works on 'controller/action/2834' doesn't match against 'controller/action/283' when there's nothing after it. problem i'm having normal regular expression don't seem working in syntax cant '(\b|[^0-9])%'

specify both possibilities, combined 'or':

update @list set searchtext = '%controller/action/' + searchtext  select id table1 t1 inner join @list l on t1.[url] l.searchtext                    or t1.[url] l.searchtext + '[^0-9]%' 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -