Use that
<add key="GetIds" value="select top 1000 Id from Table1 where dbo.RegexMatch(TEXT, '&#[0-9]+;|&amp;', 0) > 0 "/>
You should replace &
, #
and [
with their respecive HTML codes: &
, #
and [
.
Question
I have a query that needs to be read from app.config file. The query contains a regular expression. I am not able to specify character class within the regular expression value. The compiler does not recognize the character [. How do I escape it?
Here is my config file value
<add key="GetIds" value="select top 1000 Id from Table1 where dbo.RegexMatch(TEXT, '&#[0-9]+;|&', 0) > 0 "/>
where dbo.RegexMatch is a stored procedure that finds the given pattern in "TEXT".
I am getting an error that says "Invalid Character in a Decimal Number [."
Solution
Use that
<add key="GetIds" value="select top 1000 Id from Table1 where dbo.RegexMatch(TEXT, '&#[0-9]+;|&amp;', 0) > 0 "/>
You should replace &
, #
and [
with their respecive HTML codes: &
, #
and [
.