sql - How to query using Regex for the ISSN format pattern? -
using regex t-sql, trying query select records match issn pattern: http://en.wikipedia.org/wiki/international_standard_serial_number
that 4 digits, dash , either 4 digits or 3 digits , letter x, example:
1234-5678 or 1234-567x
x can lowercase.
i tried:
"\d{4}-\d{3}(\d|x|x)"
select [kbid], [issn] [issntable] [issn] '%\d{4}\-\d{3}(\d|x|x)%' order issn desc
but comes empty.
if try this:
where [issn] not '%\^d{4}-\d{3}(\d|x|x)%'
the returns in table badly formatted data.
t-sql like
pattern matcher not regex pattern matcher.
declare @issn varchar(9) set @issn = '1234-567x' select case when @issn '[0-9][0-9][0-9][0-9][-][0-9][0-9][0-9][x0-9]' 1 else 0 end isvalidissn
Comments
Post a Comment