How to find a word in select text?

if offer is in select text, i want display some message.
How can i find select text contains offer using JS?.
selObj.options[selIndex].text == "%offer%"

Take a look at javascript's string functions or regular
expressions for more complex searches. Just remember javascript is
case sensitive.
http://www.w3schools.com/jsref/jsref_obj_string.asp
http://www.w3schools.com/jsref/jsref_obj_regexp.asp

Similar Messages

  • How to find distinct words in Oracle Text index

    We have a requirement to fetch all distinct words in the CLOB field for all records
    and find the no. of records in which each word appears.
    DR$<Index Name>$I table stores exactly such information. Is it ok to use this table in queries?
    Are there any disadvantages in using it?
    Help is very much appreciated.

    the disadv -
    with every sync index the contents will change.
    with every release the structure may change without any prior information - your application may go bad.
    It is not advisable to use them in your applications. For your own investigation etc you can always use its contents.
    thanks

  • How to finds specific words in each sentence?

    import java.io.*;
    import java.text.*;
    import java.util.*;
    public class FindingWordsSpecific {
         static String[] days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "every Tuesday"};
      public static void main( String args[] ) throws IOException {
               // the file must be called 'myfile.txt'
               String s = "myfile.txt";
               File f = new File(s);
               if (!f.exists())
                    System.out.println("\'" + s + "\' does not exit. Bye!");
                    return;
               BufferedReader inputFile = new BufferedReader(new FileReader(s));
               String line;
               int nLines = 0;
               while ((line = inputFile.readLine()) != null)
                    nLines++;
                   System.out.println(findTheIndex(line));     
               inputFile.close();
           public static String findTheIndex(String sentence){
                String result = "";
                String[] s = sentence.split("\\s");
              for (String s1: s){
                   for (String s2: days){
                        if (s1.equalsIgnoreCase(s2)) {
                             if(s2.matches("every Tuesday")){
                                             }else if (s2.matches("every Wednesday")){
                                              }What is wrong with it because I tried to find "every Tuesday" in
    myfile.txt: "Go fishing every Tuesday and every Wednesday"
    There is big problem with split statement because it takes each word not more than a word.
    I need to have "every Tuesday" not "Tuesday". How to make it correct codes?

    I am going to give you a picture of how the output will look.
    Here are two sentences from myfile.txt:
    Go fishing every Tuesday and every Wednesday
    Meet with research students on Thursday
    I need to read from myfile.txt and to find specific words in each sentences like this output:
    Every Tuesday : Go fishing
    Every Wednesday : Go fishing
    Thursday : Meet with research students
    Ok. make sense? Now I am trying to figure out how to find specific words in each sentence from myfile.txt.
    That is why I have difficult with the splits statement and loops. Like this:
           public static String findTheIndex(String sentence){
                String result = "";
                String[] s = sentence.split("\\s");
              for (String s1: s){
                   for (String s2: days){
                        if (s1.equalsIgnoreCase(s2)) {
                             if(s2.matches("every Tuesday")){
                             }else if(s2.matches("every Wednesday")){
                             }else if(s2.matches("Thursday")){
                             }else{
                                  System.out.println("That sentence is not working");
                return result;
      }So look at the "Thursday" it is working the output because I have split statement to give me only one word not more than
    a word in sentence. So there is big problem with more than a word in sentence like this "every Tuesday" and it won't work at all because of split. Could you please help me how to do that? I appreciated for that help. Thanks.

  • How to get paragraph number of selected text in ID CS4

    Hi,
    Can anybody help me how to get paragraph number of selected text in Indesign cs4.
    Thanks,
    Gopal

    Ah, I see -- thanks. Turns out that there's no difference in speed between texts.itemByRange(), characters.itemByRange(),and insertionPoints.itemByRange(). In a document with 170 pages of text, and with the cursor in the last paragraph, the second and third lines, below (and your function), give exactly the same result:
    t = app.selection[0];
    t.parentStory.texts.itemByRange (t.parentStory.insertionPoints[0], t).paragraphs.length;
    t.parentStory.characters.itemByRange (t.parentStory.characters[0], t).paragraphs.length;
    Peter

  • How do you find and replace "within selected text" in a textedit document (version 1.8, mountain lion)

    In the textedit version on Snow leopard it was possible to search and replace within a peice of selected text only i.e. not the entire file. This was a very useful feature because you could select a paragraph and replace all occurences of word1 with word2 within that paragraph only! This feature appears to be missing from the mountain lion version of textedit (version 1.8). Or can anyone tell me how to do it ... ?

    Having 46 people view a post without replying is not unusual. Some people look at a question to see if it's something they'd like to know the answer to, and then come back  when it has eventually been answered.
    I'm not sure if you need to escape forward slashes in Dreamweaver's Find and Replace dialog box, but I normally do because both JavaScript and PHP normally use forward slashes as delimiters to mark the beginning and end of the regex like this:
    var pattern = /[A-Z]{4}/; // JavaScript
    $pattern = '/[A-Z]{4}/';   // PHP
    When a forward slash appears inside the regex, you need to escape it with a backslash to avoid confusion with the closing delimiter.
    As you have worked out, a capturing group is created by wrapping part of the regex in parentheses.
    If you want to match exactly 38 characters, you can use [\S\s]{38}. That includes spaces, newline characters, symbols, everything.
    If you're trying to find everything between two tags, you can do this:
    (<\/tag_name>)([^<]+)
    The closing tag is captured as $1 and everything up to the next opening tag is captured as $2.
    Learning regular expressions is not easy. I don't claim to be an expert, but I enjoy the challenge of trying to solve them. If you're interested in regular expressions, there are several books published by O'Reilly. "Mastering Regular Expressions" is the ultimate authority, but it's a difficult read (not because it's badly written, but because of the complexity of the subject). "Regular Expressions Cookbook" is very good. There's also a new "Introducing Regular Expressions", but I haven't read it.

  • Find a word in long text

    Hi,
    I need to find all the routing cards that don't contain a certain word in their long text. any suggestions???
    Eti

    Hi
    Please check in following links.....you will find some solution.
    How to search for a word in a text editor
    Search in long text
    Word Search
    search word for '.'.
    Regards
    Sujit

  • How do I print just a selected text instead of entire page?

    Hello. I have a question about printing selected text. In windows there is an option to highlight a specific text from a let's say a browser window or document. Then you can right click and hit print. When the print window comes up you can select "print selected". Is there a way to do that on Mac OS X?
    Black Macbook Core Duo 2 GHz 2GB ram Mac OS X (10.4.8)

    Try Print Selection
    <http://discussions.apple.com/post!reply.jspa?messageI
    D=4747304>
    Thanks for the reply but it took me a bit of time to figure out how to find that option!
    For those who didn't know either, it's under "Firefox" in the third section of the print window.

  • How to find a word written with two fonts...?

    Hi,
    I have a 200+ pages document that contains some words with the first letter in Times regular and the rest in Times italic. Is there any way to find those words in the document?
    Thanks

    Ooooo, Dave ....
    Annabelle, a non scripting solution is the following.
    You cannot search for words with multiple fonts. However, since you can search for words in one font, you can exclude 'good' ones.
    I will be assuming you have a regular document, with just black text ...
    In Search & Replace, GREP, search for "\b\w+\b" with a font style of "Regular" and replace with formatting: text color red. Be sure not to accidentally put anything in the replace text field -- it should be entirely empty. Now all entirely Regular words are red.
    Repeat with the font style "Italic". Now all words that are entirely Regular or Italic are in red.
    Search for "\b\w+\b" with a text color of Black. This will find all words that are neither entirely in Italic nor entirely in Regular.
    In case you never used it before, the GREP expression means "a word boundary -- one or more word characters -- a word boundary". Essentially, it does a 'Find entire word' for any length of words.
    Note that if you have words in, say, bold, bold italic, or 46 Light Italic, you will have to mark these as well with the check colour, or else you'll also find them 'bad'.
    You might want to create a new swatch for marking, so you can delete it afterwards, replacing with Black again.
    ... Are you familiar with how to use scripts? It might be a bit easier if I wrote a tiny script, although my method will find all rogue formatted text.

  • How to determine the size of selected text

    Hi
    I'd like to draw a box around some selected text (a textRange), however I can't figure out how to detemine the size or position of the text.  The overall size of a textFrame is possible to find (not sure about position), but when you've got just a few characters selected I don't see any way to get the size or position.  Any ideas?

    You may have to do some testing of your own with this… I tested here and 'think' its OK but could have overlooked something… For me the best way to get this data is to outline the type store the info in a variable then undo the outlining process… You can then continue your script with info in hand… An example that draws a box over each selected character… I cheated with only the one text frame but you can resolve that? You could easy use math.min & math.max to draw around an array of bounds… I didn't bother with a load of tests it expects selected text range as is… have fun…
    #target Illustrator
    textBoxer();
    function textBoxer() {
              var i, doc, sel, start, end, spaceB4, spaceInc, mat, grp, count, boxes;
              doc = app.activeDocument;
              sel = doc.selection;
              start = sel.characterOffset-1; // Not zero based…
              end = start + sel.length;
              doc.selection = null;
              spaceB4 = doc.textFrames[0].contents.substr( 0, start );  // Cheated here you will need to find parent frame…
              mat = spaceB4.match( /\s/g ); // Resolve the lost of white space characters before selection
              mat != null ? spaceB4 = mat.length : spaceB4 = 0;
              spaceInc = doc.textFrames[0].contents.substr( 0, end );  // Here too…
              mat = spaceInc.match( /\s/g ); // Resolve the lost of white space characters in selection
              mat != null ? spaceInc = mat.length : spaceInc = 0;
              grp = doc.textFrames[0].createOutline(); // Items in new group are last to first order
              app.redraw();
              count = grp.compoundPathItems.length;
              boxes = Array();
              for ( i = 0; i < count; i++ ) {
                        boxes.push( grp.compoundPathItems[i].visibleBounds );
              boxes.reverse(); // Fix the order
              app.undo(); // Bounce back…
              app.redraw();
              start = start - spaceB4;
              end = end - spaceInc;
              for ( i = start; i < end; i++ ) {
                                  doc.pathItems.rectangle( boxes[i][1], boxes[i][0], boxes[i][2]-boxes[i][0], -boxes[i][3]- -boxes[i][1], false );
              app.redraw();

  • How to find a word with different font format (e.g. italic and regular in one word)

    Hi people,
    I need to find a word, prefferably using GREP or simple Find/Replace tool.
    Sometimes, when I get source text to paste into InDesign, some word's format is messed up. First letter is italic and rest is regular or otherwise (or any other font format). How can I find such words automatically. For example:
    Example
    would really appreciate any help.
    best regards
    JMG.

    Hi,
    If I had to do that, using Multi-Find/Change, I would play it like:
    With MFC, I create a set of the 2 regex. So, one click to fix your problem.

  • How to find by DEFAULT the EXACT text string (and no more) with Acrobat Pro?

    How to find by DEFAULT (always) the EXACT text string (and no more) with Acrobat Pro? Adobe Acrobat Pro 9.2.0 search engine finds USELESS hits on Mactel with Mac OS X 10.5.8.
    For instance, if I search for "sec" (no quotes) trying to find ONLY hits with sec (for second, like in: it took 20 sec), it finds useless hits like: security, etc (any word containing sec, which is NOT what I want).

    Any idea on how to do it by default with Adobe Acrobat Pro 9.3.1 on Mac OS X 10.6.2 (Snow Leopard)? Thanks.

  • How to convert a Word document to text or html in an ABAP program

    Hi,
    At my client's site, for the recruitment system, they have the word processing system set to RTF, instead of SAP Script. This means that all the correspondence is in Word format. A standard SAP program takes the word letter, loads word, does the mail merge with the applicant's info and then sends the document to a printer.
    The program name is RPAPRT05. The program creates a document proxy (interface I_OI_DOCUMENT_PROXY) and manipulates the document using the methods of the interface.
    Now what we want to do is to instead of sending the document to a printer, we want to email the document contents to the applicant. But I don't know how to get the content from the Word document into text or html format so that I can make an email from it.
    I know I can send an email with the word document as an attachment, but we'd prefer not to do that.
    I would appreciate any help very much.
    Thanks

    Ok, here's what I ended up doing:
    First of, in order to call FM 'CONVERT_RTF_TO_ITF' you need the RTF document in a table with line length 156. The document is returned from FM 'DP_CREATE_URL' in a table with line length 132. So first I convert the table:
        Transform data table from 132 character lines to
        256 character lines
          LOOP AT data_table INTO dataline.
            IF newrow = 'X'.
            Add row to new table
              APPEND INITIAL LINE TO xdatatab ASSIGNING .
              newrow = space.
            ENDIF.
          Convert the raw line of old table to characters
            ASSIGN dataline TO .
          Check line lengths to determine how to add the
          next line of old table
            newlinelen = STRLEN( newline ).
            ADD addspaces TO newlinelen.
            linepos = linemax - newlinelen.
            IF linepos > datalen.
            Enough space available in new table line for all of old table line
              newline+newlinelen = oldline.
              oldlinelen = STRLEN( oldline ).
              addspaces = datalen - oldlinelen.
              CONTINUE.
            ELSE.
            Fill up new table line
              newline+newlinelen(linepos) = oldline(linepos).
              ASSIGN newline TO .
              newrow = 'X'.
            Save the remainder of old table to the new table line
              IF linepos < datalen.
                oldlinelen = STRLEN( oldline ).
                addspaces = datalen - oldlinelen.
                CLEAR newline.
                newline = oldline+linepos.
              ELSE.
                CLEAR newline.
              ENDIF.
            ENDIF.
          ENDLOOP.
        Write the last line to the table
          IF newrow = 'X'.
            APPEND INITIAL LINE TO xdatatab ASSIGNING .
    Next I call FM 'CONVERT_RTF_TO_ITF' to get the document in SAPScript format:
        Convert the RTF format to SAPScript
          CALL FUNCTION 'CONVERT_RTF_TO_ITF'
            EXPORTING
              header            = dochead
              x_datatab         = xdatatab
              x_size            = xsize
            IMPORTING
              with_tab_e        = withtab
            TABLES
              itf_lines         = itf_table
            EXCEPTIONS
              invalid_tabletype = 1
              missing_size      = 2
              OTHERS            = 4.
    This returns the document still containing the mail merge fields which needs to be filled in:
          LOOP AT itf_table INTO itf_line.
            WHILE itf_line CS '«'.
              startpos = sy-fdpos + 1.
              IF itf_line CS '»'.
                tokenlength = sy-fdpos - startpos.
              ENDIF.
              token = itf_line+startpos(tokenlength).
              REPLACE '_' IN token WITH '-'.
              ASSIGN (token) TO .
              ENDIF.
              MODIFY itf_table FROM itf_line.
            ENDWHILE.
          ENDLOOP.
    And finally I use FM 'CONVERT_ITF_TO_ASCII' to convert the SAPScript to text. I set the line lengths to 60, since that's a good length to format emails to.
        Convert document to 60 char wide ascii document for emailing
          CALL FUNCTION 'CONVERT_ITF_TO_ASCII'
            EXPORTING
              formatwidth       = 60
            IMPORTING
              c_datatab         = asciidoctab
              x_size            = documentsize
            TABLES
              itf_lines         = itf_table
            EXCEPTIONS
              invalid_tabletype = 1
              OTHERS            = 2.
    And then the text document gets passed to FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' as the email body.

  • How to bold individual word in a text caption??

    Hi,
    I'm pretty familiar with Captivate 5, though there doesn't seem to be a way to bold or underline an individual word in a text caption. This is a basic feature in most programs.
    I did search help and the forums for this. It sounds like you can either bold the text of the entire caption, though not a single word.
    Help please...
    If this functionality doesn't exist, Adobe needs to add it in the next release.
    Thanks,
    Dan

    Hi Dan
    Works for me. And it works like I would expect it to in Word or any other application.
    Select the text and press Ctrl+B to make it bold. Ctrl+U to make it underlined.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • How to find certain words based on table

    Hello,
    I have a list of words available in one particular table, based on those records i need to match it up with one specific column on another table. Based on that match i need to update the same. Please see the example for your reference in the excel file.
    Please do let me know if you need further clarifications.
    https://www.dropbox.com/s/fy5oj5r4feipqrw/Certain%20word%20sample.xlsx?dl=0
    Vinwin
    VinWin06

    One more question just out of curiosity is it possible to find out any object name or thing based on the text from table 1. Like there is no table 2 available to contain words to find the relevant records, so we have to find the words from the table 1 and
    those words mainly are any objects or a thing like bolts,shaft,spanner etc.
    Is it possible to do, always welcome to your suggestions.
    VinWin06

  • How to find out Subcon PO select which BOM

    Dear ALL,
    My question is how to find subcon PO select which alternative BoM, item details seems at material detail components tab but which atlernative BoM ?
    Regards,

    Dear,
    Check in table ENT5177 table for changes.
    In table MAST, STPO and STKO  you can check how many alternatives you have.
    (I am not sure, system not available to check).
    Regards,
    Syed Hussain.
    Edited by: Syed Hussain on Feb 20, 2011 4:39 PM
    Edited by: Syed Hussain on Feb 20, 2011 4:40 PM

Maybe you are looking for