比如说
http://url/entity/678.htm 得到678http://url/entity/5.htm 5http://url/8.htm 得到8就是说后面的 数字+.htm是固定的
http://url/entity/678.htm 得到678http://url/entity/5.htm 5http://url/8.htm 得到8就是说后面的 数字+.htm是固定的
declare @t varchar(200)
set @t = 'http://url/entity/678.htm'
set @t=substring(@t,
patindex('%[0-9]%',@t),
patindex('%[^0-9]%', right(@t, len(@t)-patindex('%[0-9]%', @t)))
)
select @t
set @t='http://url/entity/678.htm'
select reverse(substring(reverse(@t),5,charindex('/',reverse(@t))-5))