I am using the following regex expression to find SQL parameters, but it is not working under some circumstances.
\@([^=<>\s]+)((?=\s)|$)
If I use this SQL query,
select count(1) from (select * from tblEmailList109 where firstname='@FirstName') t
the value returned is:
@Firstname')
How can I modify the regex to stop stop but do not include a single quote, a space, or the end of the string?
My intention is the replace the parameter before passing it to the SQL server. I know having the single quotes in a normal stored procedure with parameters is not required, but in my case, when I do the replacement, the quotes are needed for string literals when sending to the SQL server.
Thanks
(|(?=\s)|$)to do? or more simply, what would you expect(|$)to do?