Search MS Word for Exact Match

I've got a script that opens an MS Word document, then searches through a directory for each image file (.jpg), then does a find and replace using the filename as the search string, and inserts the image in place of the text it finds. My problem is that
it's not doing an exact match. This means for example that if it looks for image1.jpg and that text exists in the word document inserts the image in it's place (the text being a placeholder). But if mimimage1.jpg was in place before it then it would insert
the .jpg there - not doing an exact match.
Here's the code I've got so far:
# Get variables from XML file
$MyDir = Split-Path $MyInvocation.MyCommand.Definition
# Get settings from variables.xml.
[xml]$settings = get-content "$MyDir\variables-test.xml"
# Assign the settings to local variables.
$SMTP = $settings.Settings.Setting.SMTP
$port = $settings.Settings.Setting.port
$from = $settings.Settings.Setting.EmailFrom
$to = $settings.Settings.Setting.EmailTo
$subject = $settings.Settings.Setting.Subject
$body = $settings.Settings.Setting.Body
$savepath = $settings.Settings.Setting.SavePath
$docfile = $settings.Settings.Setting.WordDoc
$XMLpath = "$MyDir\variables.xml"
[String[]]$strXML=@()
[xml]$xml = get-content $XMLpath
$parse_results = New-Object System.Collections.ArrayList
add-type -AssemblyName "Microsoft.Office.Interop.Word"
$wdunits = "Microsoft.Office.Interop.Word.wdunits" -as [type]
$application = New-Object -comobject word.application
$application.visible = $false
$document = $application.documents.open($docfile)
set-variable -name wdGoToLine -value 3 -option constant
set-variable -name wdGoToAbsolute -value 1 -option constant
# Create new directory
$date = (Get-Date -format "dd-MM-yyyy")
$newdir = $savepath + "archive" + "-" + $date
New-Item -ItemType directory -Path $newdir
# Search Word document for filename and insert image
foreach($file in Get-ChildItem $savepath -Filter *.jpg)
if ($application.Selection.Find.Text = $file)
if ($application.Selection.Find.Execute())
$insertfile = $savepath + $file
$objSelection = $application.selection
$objShape = $objSelection.InlineShapes.AddPicture($insertfile)
$gotoline = $objSelection.GoTo($wdGoToLine, $wdGoToAbsolute,1)
# Move spreadsheets and images to archive location and cleanup after dfm2xls.ps1 before ending script
foreach($movexlsx in Get-ChildItem $savepath -Filter *.xlsx)
$xlpath = $savepath + $movexlsx
Move-Item $xlpath $newdir
foreach($movejpg in Get-ChildItem $savepath -Filter *.jpg)
$imgpath = $savepath + $movejpg
Move-Item $imgpath $newdir
# Save document then close application
$newsave = $savepath + $date + "-report.docx"
$document.SaveAs([ref]$newsave)
$document.Close()
$application.quit()
At the moment it doesn't do an exact match but I've tried using:
$MatchWholeWord = $True
$MatchCase = $False
and then
$application.Selection.Find.Execute($MatchWholeWord, $MatchCase)
But that stopped it from finding any matches. Can anyone help?
Thanks in advance

Hi AJ Mellor,
If you want to replace the words of the .jpg file's name with the picture in word file, this script should be helpful for you to modify your script:
Hey, Scripting Guy! How Can I Read Words in a Text File and Make Those Same Word Italic in a Word Document?
Insert pictures in a folder into a Word document (PowerShell)
In addition, to get the words of the file name instead of the full path name, please refer to the script below:
$files = Get-ChildItem $savepath -Filter *.jpg
$words = $files.basename
foreach($word in $words){
I hope this helps.

Similar Messages

  • ITunes 10 search for exact match or Boolean Searches

    Is there a way to force an exact match when performing a search in iTunes?
    I tried putting "" around my search and get no results.
    The goal would be to search Artists for the artist "Hem", and only show results for only "Hem" and not both "Hem" and "Edie Brickel and the New Bohemians"
    As far as I can tell there are no Boolean search options in here either.
    iTunes 10.1 (54)

    Mad.Macs wrote:
    Thanks,
    I know Smart Playlists is a workaround for this, but that is about that is about 6 clicks plus typing to accomplish what could be done by simply typing in "hem" in the search field. If you use Smart Playlists for this, you would also need to go back and delete the playlist when you are done.
    Yep, like I said I leave it there for next time....
    I wonder why they would leave what is now a universally understood search option out of iTunes?
    Who knows? Feature requests go to iTunes Feedback.
    tt2

  • Search in file for exact phrase with special symbols [windows 8.1]

    When I search, for example, for 'name.txt' in file content it seems that it finds all files with 'name' and 'txt' in any order.
    Windows 7 seems to have options related to this, like 'use natural language' and 'find partial matches'. But I see nothing in windows 8.
    Please let me know if it's possible to search for exact phrase with special symbols.
    Thanks.

    When I search, for example, for 'name.txt' in file content it seems that it finds all files with 'name' and 'txt' in any order.
    You need to either use the Search tools or learn the Advanced Query Syntax (AQS) that they imply.  Actually you need to do both because the tools only help with the keyword prefix and not with the following syntax that is required to do the specific
    search that you want to do.
    So, for example, you knew that you wanted to find  name.txt  only in file (or directory?) names so you would use the  Other Properties > Name  tool  to be sure that your query had that prefix  Name:name.txt  
    In fact, that was a surprise for me just now because I thought the default syntax for Name with no other specification would be "contains" (which would be Name:~=name.txt) but apparently it defaults to  Name:~<name.txt  which means
    "begins with"  name.txt.  In fact, from an efficiency point of view that is probably a logical default.  But from a usability point of view it is terrible because it means that when users really want  Name:name.txt  to mean either
    "contains" or "ends with" they won't have a clue what to do to make those differences.
    Ref:
    http://windows.microsoft.com/en-us/windows7/Advanced-tips-for-searching-in-Windows
    FYI
    Robert Aldwinckle

  • Open item Settlement for exact match.

    Hi All,
    We have requirement in our project to clear the exact match first ahead of the oldest due debt.
    To elaborate on the requirement, please have a look at the following example.
    1st Invoice -$100  Due date-1/11/2010
    2nd Invoice-$250  Due date-1/12/2010
    Customer makes a payment of $250 on 10/12/2010.
    As per our requirement, It should clear the 2nd Invoice first, as it gets an exact match and not the oldest debt due.
    However, if the customer makes a payment of say $300, then it does not find any exact match and hence will clear the oldest due first.In this case,the 1st invoice.
    In the clearing Step under the clearing variant , we have tried to use the Amount rule as '0'-Clearing only possible when amounts are same.....but it is not working as per our requirement.
    Can any one of you give any thoughts on the issue?
    Thanks,
    Amlan

    Hi - tried this config, and I cleared an open item based on exact amount, that was due later that 2 other items. See below.
    Ivor Martin
    Clearing Var.   ZEX  Exact matching test
    Clearing Step   1    Exact match on amount
       Char.                    Grpng rule    Sort charact.           Rank     Sort
    1. 013  Open Amount Without In          1.
    2.                                      2.
    3.                                      3.
    4.                                      4.
    5.                                      5.
      Amount Rule     0
      Clearing rule                                  Paymt rem. var.  ZEX / 2
                                                     End of assgmt
                                           / 0
    Clearing Step   2    Oldest due date
       Char.                    Grpng rule    Sort charact.           Rank     Sor
    1. 015  Contract Account                1. 010  Due date
    2.                                      2.
    3.                                      3.
    4.                                      4.
    5.                                      5.
      Amount Rule
      Clearing rule                                  Paymt rem. var.      / 0
                                                     End of assgmt    9
                                           / 0

  • Search for exact match without additional words

    Hi everybody,
    is it possible to find out if a tag contains a certain word or phrase and nothing else? E.g. the search for all documents with the title "foo" should match all documents containing <title>foo</title> but not documents that contain something like <title>foo bar</title>. I tried something like "( foo ~ ( % ~ foo ) ) WITHIN title" but I get a "wildcard query expansion resulted in too many terms" error, so using a wildcard is no option here. Any ideas?

    Another method would be to use extractvalue to limit the rows. It would still use the text index to get the rows with foo in it, then extractvalue would limit it to just those rows where only the word foo is in it. This would eliminate the need for a procedure or user_datastore or increasing the index size. Please see the demonstration below.
    SCOTT@orcl_11gR2> create table documents
      2    (text  varchar2 (45))
      3  /
    Table created.
    SCOTT@orcl_11gR2> insert all
      2  into documents values ('<title>foo</title>')
      3  into documents values ('<title>foo bar</title>')
      4  into documents values ('<title>bar foo</title>')
      5  select * from dual
      6  /
    3 rows created.
    SCOTT@orcl_11gR2> insert into documents
      2  select '<title>' || object_name || '</title>'
      3  from   all_objects
      4  /
    76012 rows created.
    SCOTT@orcl_11gR2> create index test_idx
      2  on documents (text)
      3  indextype is ctxsys.context
      4  parameters
      5    ('section group ctxsys.auto_section_group')
      6  /
    Index created.
    SCOTT@orcl_11gR2> set autotrace on explain
    SCOTT@orcl_11gR2> select * from documents d
      2  where  contains (text, 'foo within title') > 0
      3  and    extractvalue (xmltype (d.text), '//title') = 'foo'
      4  /
    TEXT
    <title>foo</title>
    1 row selected.
    Execution Plan
    Plan hash value: 3102160860
    | Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |           |     1 |    36 |    10   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS BY INDEX ROWID| DOCUMENTS |     1 |    36 |    10   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | TEST_IDX  |       |       |     4   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter(EXTRACTVALUE("XMLTYPE"."XMLTYPE"("D"."TEXT"),'//title')='foo')
       2 - access("CTXSYS"."CONTAINS"("TEXT",'foo within title')>0)
    Note
       - dynamic sampling used for this statement (level=2)
    SCOTT@orcl_11gR2>

  • Search Array of String for exact match words

    I need to create a search feature.
    There will be a textfield where the user will input a word or words.
    Then I need to check if the are any reference in the array of names.
    namesArray ["ocean in the sky", "cean on sky", "cean is white"];
    keywordsArray ["cean", "sky"];
    matchCounter = 0;
    If I input the word "cean" I dont want in my results "ocean in the sky", only "cean is sky".
    I have the following code:
    for (var j:int = 0; j < namesArray.length; ++j)
         var tempStr:String = namesArray[j];
         for (var k:int = 0; k < keywordsArray.length; ++k)
              if (tempStr.indexOf(arrayKeywords[k]) != -1)
                  matchCounter++;
         if(lengthKeywords == matchCounter)
              trace("yeahhh... there's a match!!");
         matchCounter = 0;
    Is there a better way? How can I do this?

    There are few things but the main problem is that "new RegExp()" needs double escapes ("\\")
                var namesArray:Array = ["ocean in the sky", "cean on sky", "cean is white"];
                var keywordsArray:Array = ["cean", "sky"];
                for (var j:int = 0; j < namesArray.length; j++){
                    var matchCounter:uint = 0;
                    var tempStr:String = namesArray[j];
                    for (var k:int = 0; k < keywordsArray.length; k++){     
                        var regExp:RegExp = new RegExp("(\\s+|^)" + keywordsArray[k] + "(\\s+|$)"); 
                        if (tempStr.search(regExp) > -1){
                            matchCounter++;
                    if(keywordsArray.length == matchCounter){
                        trace("\"" + namesArray[j] + "\" matched all the keywords");
    Traces:
    "cean on sky" matched all the keywords

  • Can applescript search one file for non-matches in another file?

    I'd like to know if it's possible for Applescript to do the following:
    Take a text file with 600+ URLs and compare it to another text file with 100,000+ URLs and set out as a result any URL from the first small list that is NOT included in the second larger list?
    If it is possible to do this, is there anyone out there willing to create such a script for a modest fee?

    Hard to read the screenshot. next time cut and paste the test into the reply. Also select Replies as the display for the window in Applescript.
    The error you get, the no such file or directory are you sure that the file exists? Looks like the file is called List and it is in your desktop?
    Just tried it here and it is working OK
    Here is another copy just in case something got messed up in the first one:
              The patteren file is the smaller file with the URLs that we will lok for in the URL file
    set file1 to POSIX path of (choose file with prompt "Select patteren file:" default location alias (the path to desktop folder as text))
    set file2 to POSIX path of (choose file with prompt "Select URL file:" default location alias (the path to desktop folder as text))
    do shell script "grep -o -E '(https?|ftp|file)://.+' " & file1 & " > ~/patternFile"
    do shell script "grep -o -E '(https?|ftp|file)://.+' " & file2 & " > ~/urlFile"
    do shell script "grep -v -f ~/patternFile ~/urlFile > ~/missingUrlFile"
    --- stop copying above this line
    Just so you can see what the output in the Replies window of Applescript will look like:
    tell current application
      path to desktop as text
      --> "Mac OS Lion:Users:frank:Desktop:"
    end tell
    tell application "AppleScript Editor"
      choose file with prompt "Select patteren file:" default location alias "Mac OS Lion:Users:frank:Desktop:"
      --> alias "Mac OS Lion:Users:frank:Desktop:f1"
    end tell
    tell current application
      path to desktop as text
      --> "Mac OS Lion:Users:frank:Desktop:"
    end tell
    tell application "AppleScript Editor"
      choose file with prompt "Select URL file:" default location alias "Mac OS Lion:Users:frank:Desktop:"
      --> alias "Mac OS Lion:Users:frank:Desktop:f2"
    end tell
    tell current application
      do shell script "grep -o -E '(https?|ftp|file)://.+' /Users/frank/Desktop/f1 > ~/patternFile"
      --> ""
      do shell script "grep -o -E '(https?|ftp|file)://.+' /Users/frank/Desktop/f2 > ~/urlFile"
      --> ""
      do shell script "grep -v -f ~/patternFile ~/urlFile > ~/missingUrlFile"
      --> ""
    end tell
    Result:
    Message was edited by: Frank Caggiano - See Tony's post below

  • How to execute exact match & contains text search simultaneoulsy in Oracle 10g

    Hi,
    We have scenario where there are more than 50 million rows in a table with description column length as 1000 character. We have a web interface from where we generate a rule of comma separated keywords like
    "Standard", Single, Cancel, "deal"    & so on. The words in quotes needs to be checked for exact match & the one without quotes will be searched using contains.
    The problem is that we can have a rule of such a combination as large as 4000 characters of inclusion & 2000 such characters for exclusion (not to consider the description under exclusion) and this search when run on the table with millions of rows does not work using oracle regular expression, but works with smaller no. of search keywords.
    Is there a better way to do such a kind of search in Oracle or if not then outside oracle using any other tool
    Thanks,
    AP

    Please find below the table script, few insert statements along with the SP & function. Please help.
    -- Create Table
    CREATE TABLE Roomdescriptionmaster
    ID long,
    ROOMDESCRIPTION nvarchar2, --- max 1000 charaters
    Createddate datetime
    ----- Insert statements
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Double Room (2 Adults + 2 Children) | FREE cancellation before Mar 16, 2014 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Double or Twin Room | FREE cancellation before Feb 1, 2014 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Quadruple Room (3 Adults + 1 Child) | FREE cancellation before Mar 16, 2014 PAY LATER Full board included [ Included:10 % VAT] Meals:Breakfast, lunch & dinner included.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Triple Room with Lateral Sea View (2 Adults + 1 Child) | FREE cancellation before Dec 6, 2013 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Single Room with Lateral Sea View | FREE cancellation before Dec 6, 2013 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    --SP
    CREATE OR REPLACE PROCEDURE
    SP_PGHGETROOMDESCRIPTION(v_BId                number,
                               v_DaysOfData         integer,
                               v_Incl1              nvarchar2,
                               v_Incl2              nvarchar2,
                               v_Incl3              nvarchar2,
                               v_Excl1              nvarchar2,
                               v_CurrentIndex       integer,
                               v_RecordPerPage      integer,
                               v_IndexMultiplier    integer,
                               ref_recordset        out sys_refcursor
                               ) as
    start_index        integer;
    end_index          integer;
    Incl1              nvarchar2(2000);
    Incl2              nvarchar2(2000);
    Incl3              nvarchar2(2000);
    Excl1              nvarchar2(2000);
    v_desc_utf_value   VARCHAR2(10);
    begin
    v_desc_utf_value:= 'utf8';
      if v_incl1 is null or trim(v_incl1) = '' then
         --dbms_output.put_line('include 1 is null or blank');
         Incl1 := '';
      else
         Incl1 := lower(v_Incl1);
      end if;
      if v_incl2 is null or trim(v_incl2) = '' then
         --dbms_output.put_line('include 2 is null or blank');
         Incl2 := '';
      else
         Incl2 := lower(v_Incl2);
      end if;
      if v_incl3 is null or trim(v_incl3) = '' then
         --dbms_output.put_line('include 3 is null or blank');
         Incl3 := '';
      else
         Incl3 := lower(v_Incl3);
      end if;
      if v_Excl1 is null or trim(v_Excl1) = '' then
         --dbms_output.put_line('Exclude 1 is null or blank');
         Excl1 := '';
      else
         Excl1 := lower(v_Excl1);
      end if;
       -- Old code
       --     and regexp_like(lower(ROOMDESCRIPTION), Incl1, 'i')
       --    and regexp_like(lower(ROOMDESCRIPTION), Incl2, 'i')
       --     and regexp_like(lower(ROOMDESCRIPTION), Incl3, 'i')
       --     and not regexp_like(lower(ROOMDESCRIPTION), Excl1, 'i')
    --- First call to SP
      if v_CurrentIndex = 1 then
          start_index := v_RecordPerPage * v_IndexMultiplier;
          end_index   := (v_CurrentIndex - 1 + v_IndexMultiplier) * v_RecordPerPage;
          open ref_recordset for
         select * from (
          select ROOMDESCRIPTION, Createddate,  rownum as rn
          from roomdescriptionmaster
          where BID = v_BId
          and TO_NUMBER(trunc(sysdate) - to_date(to_char(createddate, 'yyyy-mm-dd'),'yyyy-mm-dd')) <= v_DaysOfData
          and length(FN_GET_RESTRICTION(lower(ROOMDESCRIPTION),Incl1,Incl2,Incl3,Excl1,v_desc_utf_value)) > 0
          and row_num <= v_RecordPerPage * v_IndexMultiplier
          order by row_num;
      else
      --- Subsequent calls to SP using paging from UI
          start_index := (v_CurrentIndex - 1) * v_RecordPerPage + 1;
          end_index   := (v_CurrentIndex - 1 + v_IndexMultiplier) * v_RecordPerPage;
          open ref_recordset for
          select * from (
          select ROOMDESCRIPTION, Createddate,  rownum as rn
          from roomdescriptionmaster
          where BID = v_BId
          and TO_NUMBER(trunc(sysdate) - to_date(to_char(createddate, 'yyyy-mm-dd'),'yyyy-mm-dd')) <= v_DaysOfData
          and length(FN_GET_RESTRICTION(lower(ROOMDESCRIPTION),Incl1,Incl2,Incl3,Excl1,v_desc_utf_value)) > 0
          order by roomdescriptionmasterid desc
          where rn >= start_index
          and rn <= end_index
          order by rn;
      end if;
      commit;
    end SP_PGHGETROOMDESCRIPTION;
    --Function
    CREATE OR REPLACE FUNCTION FN_GET_RESTRICTION(
    v_rate_description IN NVARCHAR2,
    v_include_1 IN NVARCHAR2,
    v_include_2 IN NVARCHAR2,
    v_include_3 IN NVARCHAR2,
    v_exclude IN NVARCHAR2, v_desc_utf_value IN VARCHAR2)
      RETURN NVARCHAR2
    IS
    CURSOR include_1_cur IS
    select regexp_substr(str, '[^,]+', 1, level) str
    from (select v_include_1 str from dual)
    connect by level <= length(str)-length(replace(str,','))+1;
    CURSOR include_2_cur IS
    select regexp_substr(str, '[^,]+', 1, level) str
    from (select v_include_2 str from dual)
    connect by level <= length(str)-length(replace(str,','))+1;
    CURSOR include_3_cur IS
    select regexp_substr(str, '[^,]+', 1, level) str
    from (select v_include_3 str from dual)
    connect by level <= length(str)-length(replace(str,','))+1;
    CURSOR exclude_cur IS
    select regexp_substr(str, '[^,]+', 1, level) str
    from (select v_exclude str from dual)
    connect by level <= length(str)-length(replace(str,','))+1;
    include_1_rec include_1_cur%rowtype;
    include_2_rec include_2_cur%rowtype;
    include_3_rec include_3_cur%rowtype;
    exclude_rec exclude_cur%rowtype;
    tmp_var NVARCHAR2(200);
    tmp_var_int NUMBER;
    tmp_flag_int NUMBER;
    return_str NVARCHAR2(200);
    tmp_length NUMBER;
    tmp_length_include_1 NUMBER;
    tmp_length_include_2 NUMBER;
    tmp_length_include_3 NUMBER;
    tmp_length_exclude NUMBER;
    tmp_regex_pattern VARCHAR2(1000);
    flag_include_1_match INTEGER;
    flag_include_2_match INTEGER;
    flag_include_3_match INTEGER;
    flag_exclude_match INTEGER;
    BEGIN
      tmp_length_include_1 := nvl(length(v_include_1),0);
      tmp_length_include_2 := nvl(length(v_include_2),0);
      tmp_length_include_3 := nvl(length(v_include_3),0);
      tmp_length_exclude := nvl(length(v_exclude),0);
      flag_include_1_match := 0;
    flag_include_2_match := 0;
    flag_include_3_match := 0;
    flag_exclude_match := 0;
      IF tmp_length_include_1>0 OR tmp_length_include_2 >0
      OR tmp_length_include_3 >0 OR tmp_length_exclude >0 THEN
      IF v_desc_utf_value ='utf8' THEN
        ----------------------------------------------------- UTF 8 STARTED --------------
    -----------------------------------------   INCLUDE 1
      tmp_length := tmp_length_include_1;
      IF tmp_length > 0 THEN
      tmp_flag_int :=0;
    FOR include_1_rec in include_1_cur
    LOOP
      tmp_var := trim('' || include_1_rec.str);
      --dbms_output.put_line(tmp_var);
      tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
      tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_1_match := 1;
      EXIT;
      END IF;
    END LOOP;
    ELSE
      flag_include_1_match := 1;
    END IF;
    --------------------------------------------  INCLUDE 2
    tmp_length := tmp_length_include_2;
      IF tmp_length > 0 THEN
        tmp_flag_int :=0;
    IF flag_include_1_match =1 THEN
      FOR include_2_rec in include_2_cur
    LOOP
      tmp_var := trim('' || include_2_rec.str);
    tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
      tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_2_match := 1;
      EXIT;
      END IF;
    END LOOP;
    END IF;
    ELSE
      flag_include_2_match := 1;
    END IF;
    -------------------------------------------- INCLUDE 3
    tmp_length := tmp_length_include_3;
      IF tmp_length > 0 THEN
      tmp_flag_int :=0;
       IF flag_include_2_match =1 THEN
      FOR include_3_rec in include_3_cur
    LOOP
      tmp_var := trim('' || include_3_rec.str);
    tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
      tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_3_match := 1;
      EXIT;
      END IF;
    END LOOP;
    END IF;
    ELSE
      flag_include_3_match := 1;
    END IF;
    -------------------------------------------- EXCLUDE
    tmp_length := tmp_length_exclude;
    IF tmp_length > 0 and flag_include_3_match =1 THEN
      FOR exclude_rec in exclude_cur
    LOOP
      tmp_var := trim('' || exclude_rec.str);
    tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
      tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int := -1;
      return_str := '';
      EXIT;
      END IF;
    END LOOP;
    END IF;
      ELSE
      ----------------------------------------------------- UTF 16 STARTED --------------
      -----------------------------------------   INCLUDE 1
      tmp_length := tmp_length_include_1;
      IF tmp_length > 0 THEN
      tmp_flag_int :=0;
      FOR include_1_rec in include_1_cur
    LOOP
      tmp_var := trim('' || include_1_rec.str);
      --dbms_output.put_line(tmp_var);
    tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_1_match := 1;
      EXIT;
      END IF;
    END LOOP;
    ELSE
      flag_include_1_match := 1;
    END IF;
    --------------------------------------------  INCLUDE 2
    tmp_length := tmp_length_include_2;
      IF tmp_length > 0 THEN
        tmp_flag_int :=0;
    IF flag_include_1_match =1 THEN
      FOR include_2_rec in include_2_cur
    LOOP
      tmp_var := trim('' || include_2_rec.str);
    tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_2_match := 1;
      EXIT;
      END IF;
    END LOOP;
    END IF;
    ELSE
      flag_include_2_match := 1;
    END IF;
    -------------------------------------------- INCLUDE 3
    tmp_length := tmp_length_include_3;
      IF tmp_length > 0 THEN
      tmp_flag_int :=0;
       IF flag_include_2_match =1 THEN
      FOR include_3_rec in include_3_cur
    LOOP
      tmp_var := trim('' || include_3_rec.str);
    tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_3_match := 1;
      EXIT;
      END IF;
    END LOOP;
    END IF;
    ELSE
      flag_include_3_match := 1;
    END IF;
    -------------------------------------------- EXCLUDE
    tmp_length := tmp_length_exclude;
    IF tmp_length > 0 and flag_include_3_match =1 THEN
      FOR exclude_rec in exclude_cur
    LOOP
      tmp_var := trim('' || exclude_rec.str);
      tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int := -1;
      return_str := '';
      EXIT;
      END IF;
    END LOOP;
    END IF;
    END IF;
    IF tmp_flag_int = 1 THEN
    return_str := 'truely matched';
    ELSE
    return_str := '';
    END IF;
    ELSE
    return_str := '';
    END IF;
    return return_str;
    EXCEPTION
      WHEN OTHERS THEN
      --dbms_output.put_line('Exception');
        RAISE;
    END FN_GET_RESTRICTION;

  • I am wanting to exactly match two ID numbers from two differing worksheets within one work book. Once matched I am wanting to retrieve a row value from the second worksheet into the first. Any help much appreciated.

    I am wanting to exactly match two ID numbers from two worksheets within the one work book. ID numbers are non linear. Once exactly matched I wish to retrieve a corresponding row value from worksheet two and have it appear in worksheet one against the correct ID number. I have been looking at IF, VLOOKUP, and MATCH functions and suspect that what I want to do requires a combination of two or more. Any help will be greatly appreciated.
    regards Vaughanh

    Vaughan,
    Data A:D is all cells start at column A thru column D.
    There is built-in help using the menu item "View > Show Function Browser"  in the search field (top right) you can enter vlookup and you will see the detailed description.
    From this we see:
    VLOOKUP
    (search-for, columns-range, return-column, close-match)
    search-for:  The value to find. search-value can contain any value type.
    columns-range:  A range of cells. range is a reference to a single range of cells, which may contain values of any type.
    return-column:  A number that specifies the relative column number of the cell from which to return the value. return-column is a number value. The leftmost column in the range is column 1.
    close-match:  An optional value that determines whether an exact match is required.
    close match (TRUE, 1, or omitted):  If there’s no exact match, select the column with the largest top-row value that is less than the search value. Wildcards can’t be used in search-for.
    exact match (FALSE or 0):  If there’s no exact match, return an error. Wildcards can be used in search-for.
    So... the 2,0 means return the value form the same row as the lookup value but from the 2nd column of the range.  3, 0 means from the 3rd column.  the ", 0" means exact match

  • How to get exact match when working with Oracle Text?

    Hi,
    I'm running Oracle9i Database R2.
    I would like to know how do I get exact match when working with Oracle Text.
    DROP TABLE T_TEST_1;
    CREATE TABLE T_TEST_1 (text VARCHAR2(30));
    INSERT INTO T_TEST_1 VALUES('Management');
    INSERT INTO T_TEST_1 VALUES('Busines Management Practice');
    INSERT INTO T_TEST_1 VALUES('Human Resource Management');
    COMMIT;
    DROP INDEX T_TEST_1;
    CREATE INDEX T_TEST_1_IDX ON T_TEST_1(text) INDEXTYPE IS CTXSYS.CONTEXT;
    SELECT * FROM T_TEST_1 WHERE CONTAINS(text, 'Management')>0;
    The above query will return 3 rows. How do I make Oracle Text to return me only the first row - which is exact match because sometimes my users need to look for exact match term.
    Please advise.
    Regards,
    Jap.

    But I would like to utilize the Oracle Text index. Don't know your db version, but if you slightly redefine your index you can achieve this (at least on my 11g instance) :
    SQL> create table t_test_1 (text varchar2(30))
      2  /
    Table created.
    SQL> insert into t_test_1 values ('Management')
      2  /
    1 row created.
    SQL> insert into t_test_1 values ('Busines Management Practice')
      2  /
    1 row created.
    SQL> insert into t_test_1 values ('Human Resource Management')
      2  /
    1 row created.
    SQL>
    SQL> create index t_test_1_idx on t_test_1(text) indextype is ctxsys.context filter by text
      2  /
    Index created.
    SQL> set autotrace on explain
    SQL>
    SQL> select text, score (1)
      2    from t_test_1
      3   where contains (text, 'Management and sdata(text="Management")', 1) > 0
      4  /
    TEXT                             SCORE(1)
    Management                              3
    Execution Plan
    Plan hash value: 4163886076
    | Id  | Operation                   | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |              |     1 |    29 |     4   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_TEST_1     |     1 |    29 |     4   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | T_TEST_1_IDX |       |       |     4   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("CTXSYS"."CONTAINS"("TEXT",'Management and
                  sdata(text="Management")',1)>0)
    Note
       - dynamic sampling used for this statementJust read that you indeed mentioned your db version in your first post.
    Not sure though if above method is already available in 9i ...
    Message was edited by:
    michaels

  • Search for calendars with exact match

    Hello,
    I am work on customisation of uwc. I have problem with calendar search. I am getting the result of substring matches. I want to have exact matches. I suppose that it is some kind of configuration of Sun Calendar Server. Could you give me please some advices?
    Thank you

    Hi,
    jslezak wrote:
    I am work on customisation of uwc. I have problem with calendar search. I am getting the result of substring matches. I want to have exact matches. I suppose that it is some kind of configuration of Sun Calendar Server. Could you give me please some advices?Which screen are you talking about precisely? Is this the calendar subscription search screen or the attendee search screen?
    A number of the searches are controlled by the calendar ics.conf file. So try matching the directory access entry which relates to your search to the appropriate string in ics.conf and that should provide a guide as to what needs to be changed.
    Regards,
    Shane.

  • Search for exact phrase

    (Adobe Reader XI, version 11.0.06, Windows 7 Professional SP1, 32-bit)
    I'm reviewing a PDF document that has various occurrences of mixed case "plug-in", "plug in", and "plugin", sometimes the 'p' and/or 'i' is capital.  I cannot find a way to make Reader XI search for and match ONLY the following 7 characters:
    plug in
    That's p-l-u-g-space-i-n.  When performing a case-insensitive search for <plug in> (I'm using < and > as delimiters just for the rest of this message posting, can't use quotes as you'll see shortly) it matches <plug in>, of course, but it also matches <plug-in>.  I don't want all those <plug-in> matches because a hyphen is not a space.  (There are LOTS of matches on <plug-in> and they bury the few matches of <plug in>.  So I gotta search this big list to find the few correct matches...and then wonder if I missed any.)
    In the advanced search option it says to use quotes to make Reader search for an exact phrase or words.  Well, when using quotes in the search box they are not delimiters of an exact phrase, they are part of the search.  For example, as a sanity check I did a search on the eight characters quotation-p-l-u-g-i-n-quotation <"plugin">.  That should match all occurrences of <plugin> because I enclosed it in quotation marks, right?  The search for <"plugin"> produces one match - the single instance of <"Plugin"> in the entire document...so the quotes are part of the search, they don't delimit an exact phrase.
    I'm sure the error is on my part, I just don't know what I'm missing here.  Please help if you can.
    thanks,
    Steve T.

    Thanks for the quick response, Gilad D.  I tried those options before posting this question, and again about 5 minutes ago just to be sure.  I tried them both together and both separately, but no joy - searching for <plug in> still matched both <plug in> and <plug-in>.

  • Simple Search - Exact Match

    Hi,
    I have one requirement where user want to returns extact match unless user explicitly specify % in the search column;
    For Ex: Lets say user enter 24 it should return any records that matches exact value. Currently it returns all the value starting with 24 in simple search.
    I understand that we can use different operators in Advance Search.
    I tried to dynamically add where clauss in CO but I am getting lots of error arround bind variables.
    Please advice.
    Thanks,
    Mahesh

    Any input value in the LOV field will go for partial match.
    --Shiv                                                                                                                                                                                           

  • How to search and remove all exact words

    How to search and remove all exact words, I have tried adobe 11 Pro and I still need to know how to do this

    That works well for replace or deleting one at a time, I need to search the doc and delete all found and not change formatting
    Thank you for your help

  • Searching for exact text

    Hi - I've a problem when looking for exact text, eg:
    SetStatusBarMessage AND "C#"
    This matches any words beginning with C - how can I specifically look for the phrase C# ??
    (see the results: http://img12.imageshack.us/img12/5259/screenw.gif )
    Pat Read

    No. There is nobody here who works for Apple, the forum us strictly user-to-user.
    I wouldn't say it's "strictly user-to-user". As terms & conditions states:
    Apple involvement. Apple does not formally provide technical support on the Site. However, any information that is provided by Apple or Apple employees is offered on an "AS IS" basis without warranties of any kind.
    Thanks for the suggestion. Although, the problem is not really to get rid of the message (as you can dismiss it quite easily) but to understand why it appears there in the first place. Is it a malware? is it a bug?
    So thanks for that. Although as you mentioned, it wasn't very enlightening.
    (The 2000 views were probably a couple of years ago. Look at the dates on the posts.)
    I did. Half the people who posted had this issue in 2011, and the other half (including me) posted in the last couple of months. So it might be a recurring thing.
    I have no idea when 2000 users googled "Tap Continue and sign in to purchase a gift" and viewed this post. Could have been 2 years ago or in the last couple of months.

Maybe you are looking for

  • Launching Web Start Program from an Applet?

    Hi, I need to launch web start program from an applet. How can I do that? I have tried opening a new web page pointing to the jnlp file from an applet. But, that does not seem to start the web start. Thanks in advance rg

  • Read Infotype  0167 and writes WT in Internal Table

    Hi gurus, I need to read the healt plans in IT0167 in the payroll. I am using the P0167 PAR1-BEG function, and it reads the table, but, do not write any wage type in IT table. Do you know what I am missing?

  • A Swing GUI problem.

    There are a JTextfield for entering an integer, a JButton that can be used to square the integer, and another Textfield to show the result. Two questions: 1) After typing the integer, I want to enter Enter-key to get the result, instead of pressing t

  • Iweb question. How can you remove music from a page?

    How can you remove music from a your welcome page on iweb? Dumb but I can'f figure it out.

  • Someone PLEASE help me. My iPod touch shuffles all my music!

    I need help! My iPod won't stop shuffling! So here's what I do . 1. Open Music. 2. Pick an artist. 3. Pick an album. 4. Pick the song at the top of the list. Now after the song is over, it should play the next song down on the list, right? But it nev