Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 grouping of charecters inside the [] regular expre

Author  Topic 

sarfrazabdu
Starting Member

5 Posts

Posted - 2014-02-07 : 09:54:50
I have a .Net application and which is connected to a backend SQL server.
The .Net application has a search functionality to search data from the database and retrieve the same and show up in the .net application.

This is an existing application and is working fine now .

The existing search query is select * from table where coumname like ‘%searchstring%’

A new requirement is that we need to search for Html tag also .the html data in the database are encoded(htmlenoded) and saved in the database.
Also there is a requirement that if we have a double quotes in the search string we need to search for all French double quotes in the database.
For this if we are searching for a string name”s , we have to search for the different combinations like
Name[““”«»]s
That is we have search for Name”s , NAme”s , NAme”s Name«s and Name»s

SqlString ( the parameter which is passed to the stored procedure ) will be encoded version of this -- Name[“” ”«»]s

This works if the encoded version of quotes is a single letter , for example for “ it Is “ itself.

But for is « it is #171; and for » it is #187;
So the search string is Name[“” ” #171; »#187;]s

This search for each individual charecters , which brings wrong search and also getting conection time out because of the huge search.

Just was looking if there is any way to group the encoded html charecters so that we search for the entire html charecters at a stretch( eg:-. #171;).

I am attaching the SP with this mail.
You may look first in to the sql2 first( both are used for searching in different scenarios)..

I am looking for the easiest way to implement the same.


sarfraz

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2014-02-15 : 14:42:18
Post sample data and desired results.


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page
   

- Advertisement -