This is a mirror of official site: http://jasper-net.blogspot.com/

TSQL Challenge 34 - Search for two keywords within the maximum distance of one word between them

| Monday, July 26, 2010
This challenge is all about searching for two keywords in a string with a maximum distance of 'one word' between them.

For example, if 'sql' and 'server' are the keywords, a match will be found on 'Microsoft SQL Server 2008' as well as on 'I like sql and server'. The second phrase matches because there is only one word between 'sql' and 'server' which is acceptable.

Note also that the search keywords can occur in any order within the string. If you search for 'sql' and 'server' a match can be found in 'Exchange Server runs SQL' because both the keywords occur in the string within the distance of one word ('runs').

Source data:
ID Data
-- -------------------------------------------------------------------------------------
1  Modern technology Owes ecology An apology
2  It has become appallingly obvious that our technology has exceeded our humanity
3  If it keeps up man will atrophy all his limbs but the push button finger
4  Our Technology presumes there is just one right way to do things and there never is
5  Technology is the knack of so arranging the world that we do have to experience it
6  Do you realize if it were not for Edison we would be watching TV by candlelight
7  Simply put have we covered all our bases

Read more: Beyond relational

Posted via email from .NET Info

0 comments: