REGEXP_LIKE and search for whole words in a string

Try to find a way to use regexp_like (in 11 GR 2) to find whole words, not partial, within a string.

For example:
create table regex_test (id int, name varchar2(30));

insert into regex_test values (1, 'John featuring Jane');
insert into regex_test values (2, 'Featuring John and Jane');
insert into regex_test values (3, 'John and Jane');
insert into regex_test values (4, 'John featuring');
insert into regex_test values (5, 'John with Jane');
insert into regex_test values (6, 'John and Jane within intro');
The goal here is to find all names that contain the words 'featuring' and 'with '. Case-insenstive. Does not not on ' in the '.

We are looking for hits on ID 1, 2, 4 and 5 and have not been able to find a good example there.

Thank you
Todd

Hello

Here's one way:

...
WHERE     REGEXP_LIKE ( ' ' || name || ' '
              , '( featuring )|( with )'
              , 'i'
              )

This assumes that the words are separated by spaces, no legs or punctuation. If this isn't the case, then it's a bit messier; Maybe

WHERE     REGEXP_LIKE ( ' ' || name || ' '
              , '(\Wfeaturing\W)|(\Wwith\W)'
              , 'i'
              )

\W means anything that is not usually a part of a Word.

Thanks for posting the CREATE TABLE and INSERT statements; It's very useful!

Published by: Frank Kulash, February 8, 2011 14:17
\W version added

Tags: Database

Similar Questions

  • Windows 7 can search for files containing a specific string that includes punctuation

    I have a documentation for a programming language which is in the form of html on my machine and search for files that contain the string "${1}".

    However if I type that in the search box windows instead seeks any file containing the string '1' in its content or its file name or a folder (which gives me 10240 results!)

    Research I try it is possible with a different syntax (escape the $ and brackets to indicate that they are part of the search maybe string)?

    Thank you

    MOG

    Hi Mog,

    Because the question you posted is related to search for files containing a specific string, it would be better suited in the MSDN forum. Please post your question in the following MSDN forum:

    http://social.msdn.Microsoft.com/forums/en-us/windowsgeneraldevelopmentissues/threads

  • RoboHelp can produce a decent online help 508 compliant? When I try, TOC, IX and search for bad air.

    I have Windows 7 and RoboHelp 9. I take a long Word document and convert it to help online. The OCD, IX and search for bad air. I contacted Adobe Support and up to now, they say it's just what assistance 508 compliant is supposed to look like, even if I keep coming back to try to get different opinions. Specifically, the table of contents entries are not expandable and collapsible, it shows just the whole thing. They show no legs. The index produces numbers like 2_1_1_Add_a_New_Outcome.htm entries. Research shows the symbols and numbers, starting by! 1 2 3 4 5 6 7 8 9 10 11, and has no search box to enter a Word to search for. Anyone know if it's really only 508 compliant I can get of RoboHelp, please help?

    Hi Tom

    Sorry, I've had an incredibly taxing a few days and I forgot your last question, ask questions about WebWorks.

    Unfortunately, I have no idea how WebWorks. In addition, I'm not any kind of expert on Section 508 compliance. I heard "collegial" of it but none to support than real life. And because the way I didn't stay in a Holiday Inn Express last night, I can't pretend to be an expert.

    Maybe someone else here knows about WebWorks and maybe speak to that. Or, you could ask another meeting place. Maybe WebWorks has their own forums? Or you could try asking on TECHWR-L or HATT.

    http://www.techwr-l.com/archives/

    http://groups.Yahoo.com/group/Hatt/

    See you soon... Rick

    Useful and practical links

    Wish to RoboHelp form/Bug report form

    Begin to learn RoboHelp HTML 7, 8 or 9 in the day!

    Adobe Certified RoboHelp HTML Training

    SorcerStone blog

    RoboHelp EBooks

  • Search for a word in a Web page

    Hello

    I have a little problem on the search in a web page.

    Without worrying to highlight what is useful in all software, how can I search for a word in a Web page?

    I mean imagine in windows, through the web page, you need to find the word "except", if you come to use the Toolbox in the browser and type except to indicate each word "except" in this page and highlight it. Is there a similar option for safari for Mac too?

    F command should do what you want. -AJ

  • Search for a word in all my files on the mac HD

    Is there a function in the application of SEARCH to the search for a word or phrase in all my files to my Mac Book Pro HD?

    Have you tried spotlight and searched on "content?  See this discussion.

  • Search for several words in SQL

    I want to be able to search on multiple words in sql.  If someone entered in the field search for several words like "industry of corn for biofuels". I want to return all records that has one of these words in them.  Here is my code: (brings back only the sentence and not individual words in the database)

    and)
    path as < cfqueryparam cfsqltype = "cf_sql_varchar" value="%#arguments.searchterms#%" > "
    or
    the body as < cfqueryparam cfsqltype = "cf_sql_longvarchar' value="%#arguments.searchterms#% ">"
    or
    Summary as < cfqueryparam cfsqltype = "cf_sql_varchar" value="%#arguments.searchterms#%" > "
    or
    the author as < cfqueryparam cfsqltype = "cf_sql_varchar" value="%#arguments.searchterms#%" > "
    )

    something like this:

    Select somefields

    of sometables

    where 1 = 1

    and

    (

    or concat (Field1, Field2, etc.) like ' %#word #% ".

    or 1 = 2

    )

    Just to let you know, it will be slow.   Also, if one of these fields accept NULL values, you will have to deal with that.

  • How can I find Notes? I have a lot so I need to search for key words

    How to search for key words in the Notes?

    Use Spotlight search.

    Go to settings > general > Spotlight search to check that Notes is included in the search.

    To open the Spotlight search shot down with one finger begin in the middle of the home screen.

  • How can I search for a word in several files in a particular folder?

    Original title: search for a specific word

    Hello

    I'm working on Windows 8. How can I search for a word in several files in a particular folder?

    TKS

    Provide the location is indexed, you can search for a specific phrase or Word file Explorer by typing content: follow-up of your phrase surrounded by quotation marks. This will produce a list of files, the filtering criterion.

  • title search for the words HTTP and 404. __

    I am unable to get the photo galleries to display on this site that I would use often:http://english.vietnamnet.vn/en/vietnam-in-photos/349/hanoi-s-folk-festivals-in-old-photos.html

    Technical information (for support personnel)

    Hi Gowest,

    • Were you able to see the photos earlier on this site?
    • Are you able to see the pictures on other sites?

    This seems to be a problem with the Web site. Even I tried to access the link and I was unable to see the pictures on this particular link and it shows red x instead of the image and clicking on it gives the same error you posted.

    You can communicate with the support of Web site to check if they have any problems with the images in the link of the Web site.

    I hope this helps.

    Thank you and best regards,

     

    Srinivas R

    Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Can I search for a word in the description of a bookmark?

    When I add a bookmark, I often add a description.
    Another reason why a lot of my favorites are the descriptions is that I am an old user of delicious and I imported these bookmarks in Firefox.
    So I would like to search for words that I wrote in the description, because the description is often more significant than the label, the name or the URL.
    But unfortunately Firefox does not resemble the description during the search in bookmarks.
    Nor find any extension.

    A backup of bookmarks HTML includes descriptions, so you could open such a backup in a tab and use the search bar to search the page.

    You can make Firefox create an automatic HTML (bookmarks.html) backup when you exit Firefox, if you set the pref to true on the subject browser.bookmarks.autoExportHTML: config page.

    This backup is created by default in the profile as bookmarks.html folder whenever you close Firefox, but you can set the file name and the path through the pref browser.bookmarks.file on the topic: config page.

    The pref browser.bookmarks.file does not exist by default and you must create a new pref to string with the name browser.bookmarks.file and set the value to the full path of the file backup bookmarks including the name of the file.

  • Indexing options and search for Windows 7 are not locate content of the document since "update" Open Office 3.3 3.4 (he worked for 2 years before that)?

    I have Win 7 with Service Pack 1. I have "updated my Open Office 3.3 to 3.4 and now Win 7 search and options DO NOT locate my document content indexing more? I contacted the support of Open Office: http://user.services.openoffice.org/en/forum/viewtopic.php?f=15&t=55483

    They claim that: "indexing and search in Windows 7 are performed by Windows 7", so there is a problem with Win 7 search and indexing options.

    I checked the indexing options in Windows 7 and the "Index Properties and content of the file" is selected for ALL the 'odt' as well as all the files 'o'.

    I set up a test document: I put only one word "Wednesday" in the Open Office text document, saved and it called "text". I am looking for Wednesday and the search comes up with two other documents containing the word Wednesday in them, but not the Test document?

    I just discovered something. When I did the 'Test' experience above, the file was saved in format 'odt' a:. I changed it to a ".doc" file and it now appears in the search results. As mentioned above, I've changed ALL the files starting with the letter 'o' in Indexing Options > Advanced Options > Types of files to the article: 'properties Index and contents of the file. The description of filter for files 'odt' comes back as: "IFilter shop OpenOffice IFilter" where as 'doc' filter is listed as a: «Filter Microsoft Office» Is it a "Boutique OpenOffice IFilter IFilter: issue" Blocking "the documents appear in the search results? If so, how should I do (I mean in addition to all the documents 'odt' replacing 'doc'?

    Just to clarify: document names 'odt' come to a search, but not the content document.

    Hello

     

     

    Method 1: Run the following fix - it:

    Difficulty of Windows Desktop Search when it crashes or not display results:

    http://support.Microsoft.com/mats/windows_search/en-us

    Method 2:  Restore the computer to a date when it was working fine before:

    Reference:

    System Restore: frequently asked questions:

    http://Windows.Microsoft.com/en-us/Windows7/system-restore-frequently-asked-questions

  • How to search for a Word document in Windows 8?

    I'm stumbling around Windows 8 that came pre-loaded on my new laptop.  I ordered Windows and Excel to be included in the package.  I saved a number of documents in Word, and now I need to get these documents for a particular.  I looked on the Internet and found a lot of no-help, that is to say, 'go in search of a file'.  Excuse me, but if I could find searching a file, I could probably find out how to search for the file, Huh?  Thus,.

    Could someone please help me with: how to find a Word document (1) and (2) where is the infamous "search"?

    I did the thing 'sweep to the right side of the screen"to get those things shadow to appear, and click on the magnifying glass (which I think the engineers forgot to change when they changed everything!) and if I wanted to search for apps, I'd be in great shape.  But his files I'm looking for, Word documents.  The designers of this 'new' version improved - well, new, in all cases seem to have forgotten those of use who use computers for productive work and not socialize or play games.

    Sorry for the hike and whining, but I'm very frustrated that the tasks that were once very simple are now extremely difficult to fill.

    It's pretty easy, at the beginning screen just type the name of your document and right it will bring the search screen and you select files (files, settings, Apps). Take a look at:

    http://Windows.Microsoft.com/en-us/Windows-8/search-apps-files-settings

  • Acrobat XI can search for several words at a time?

    Every day I check a long list of words in a new and large file I'm sent. I tried to look up these words doing a single search query, but it seems that it's not possible. In the advanced search section I hace tried to do queries like word1 word2, nothing. Word1 AND word2, nothing. Word1 + word2, nothing. Nothing works. Can search for acrobat even more than one word at a time?

    Thanks for your comments.

    Kind regards.

    Jose.

    Of course, it is possible. In the advanced search window, press show more Options then select 'Match any of the words' under the heading "Return results containing" and enter your search terms separated by a space, like this:

  • using 'like' to search for multiple words in the search sql sentence

    HI, at the moment I have a cfquery as follows

    < name cfquery = 'test' datasource = "" #datasource # "cachedwithin =" #CreateTimeSpan (0,1,0,0) #">"
    SELECT * to #tablename # where nom_entree is not null and (nom_entree like ' %#keyword #% ')
    order of sequencename
    < / cfquery >

    If the EntryName fiield is for example 'Shepton Mallett', it will be back if I search 'Shepton' or "Mallett" or 'Shepton Mallett', however if I spell 1 word of the search expression erroneous "i.e Shepton Mallatt", he finds no results. I realize that I have to split the sentence search and search on these two words, but not very well what is the right way to do it. I also wanted to strip of common words (IE, a, etc.) of the expression of research if it does not return loads of results. I prefer to keep if possible in sql (not verity)

    Thank you very much

    Oli

    Thank you, perfect

  • pushState() and search for a product

    Hi all

    thought ways of tweaking of the browsepanel to do what I need, and it dawned on me that. pushState() might be the way to go.

    The idea is that browsepanel users to navigate in the catalogues, I basically strip some keys to search for products and use {module_url} and. pushState() to simply tweak the url to my needs - especially for the fly then, sorts including sort by price and by the search for products usual sortTypes.

    I had thought before including module product_results with sortType different values by default, but then I would need to get the ID of the catalog of the URL (right?) anyway, so maybe also try well pushState()?

    I was hoping that others may have experimented with this and be able to tell me if this is achievable in British Colombia. Furthermore, any ideas to other successful approaches would be good.

    Ideas, suggestions and experiences related to the foregoing, all appreciated very strongly (it is the last great problem to be solved before the launch).

    I will let you know that even if I'm pretty comfortable with the html and css, my js is pretty basic, but I'm happy to do the legwork to learn it. I'm not after a tutorial here, just hope to know if the approach is feasible before committing too much time to it. Oh, and I already have a menu set up for browsing catalog and products and quick searches in the appropriate places, just FYI.

    See you soon,.

    Jason

    Pushstate will trigger new pages and not what your after.

    You need to use the data of this kind of things with Ajax if your update but keeping the same page.

    Site not finished, but we have made for one person:

    http://lemonzebrakids.BusinessCatalyst.com/products/girls/accessories

    And made several variations of this, some more complicated then others.

Maybe you are looking for

  • The bios z50 site been hacked?

    Downloaded bios Z50 9/24: http://support.Lenovo.com/us/en/products/laptops-and-netbooks/Lenovo-z-series-laptops/LENOVO-Z50-70/... None of checksums match. The site has been hacked? Sean

  • View the log files and message tracking

    Just our ES3300 running. Looked through the Administrator's guide and searched a bit, is there not another way to view a log of what happened through the system of having to download log files?

  • cannot force the player to stop playback of the audio file

    Hi guys,. I'm stuck with the pretty easy task. I have an audio player, start playing the audio file and I just want to stop it, do not wait until the player arrives at the end of the media. But nothing happens! The media playing contiunes. And there

  • Cannot find the ability to select multiple messages in inbox to delete PCA.

    Hello I do not know what is missing and all default settings are made on behalf of undeliversablemessagemailbox and still I don't see the option of multiple selection for the removal of the PCA Cisco Inbox Inbox. Please let me know if things should b

  • the most recent version to the CC2015?

    I had a major problem the other day and I don't know if I have the current version (as the desktop application was not show which was active or not). I have AuCC2015.2.Kind regardsGraham