Combinations of elememnts in col1 matches to a string in col2

please give an idea this kind of scenario
i have data like
select 'a' col1,'a c b d' col2 from dual union all
select 'c','b' from dual union all
select 'b','d' from dual union all
select 'd','ab' from dual union all
select 'e','e f' from dual union all
select 'f','f' from dual union all
select 'g','g' from dual
etc
here the logic is a,b,c,d fits to one string one string col2 'a b c d' and e,f fits to one string in col2 'e f' and g fits to only 'g'
how i can pick that strings,using the col1 .i am using oracle9i
col2
a b c d
e f
g

it is basic usage of instr :D
where instr(col2,col1) > 0

Similar Messages

  • Error: Sequence does not match type xs:string

    I am using BDB XML 2.5.16 to store and query my XML  documents in Java. The documents are IMDB xml documents containing actors information
    obtained from INEX website https://inex.mmci.uni-saarland.de/login.jsp.  One of  the document I stored in the database is the following
        <?xml version="1.0" encoding="UTF-8"?>
         <persons>
          <person>
              <name>jason angeles
              </name>
              <filmography>
                 <act>
                    <movie>
                       <title>prison planet 3 the revenge 1998
                        </title>
                      <year>1998
                      </year>
                     <character>evil ninja
                      </character>
                   </movie>
                 </act>
              </filmography>
             </person>
             </persons>
    I want to  search using XQuery  for filmography element whose title element contains ANY of the following keywords ('planet', 'revenge', '1998'). Below is the query I used
                  // declaring function functx:contains-any-of
                String qryRk = "declare namespace functx = 'http://www.functx.com'; " 
                      + "declare function functx:contains-any-of "
                     + "( $arg as xs:string?" + " , "  + " $searchStrings as xs:string* )  as xs:boolean { "
                     + "some $searchString in $searchStrings "
                    +  " satisfies contains($arg,$searchString)} ; ";
                 String myQuery101 = qryRk + "for $entity in collection('simpleExampleData2.dbxml')//filmography "
                      + "where functx:contains-any-of ( $entity/act/movie/title ,  ('planet', 'revenge', '1998'))"
                      + "return $entity";
    When I  execute the query  i  expect to get at least get the following element as mu output
                           Document : person_31000.xml:
                        <filmography>
                               <act>
                                     <movie>
                                     <title>prison planet 3 the revenge 1998
                                    </title>
                                    <year>1998
                                    </year>
                                   <character>evil ninja
                                   </character>
                                  </movie>
                               </act>
                             </filmography>
    However instead of the above element i got the  following Error
                                 Exception in thread "main" com.sleepycat.dbxml.XmlException: Error: Sequence does not match type xs:string? - the sequence contains more than one item [err:XPTY0004], <query>:1:343, errcode =               
                                  QUERY_EVALUATION_ERROR
                                      at com.sleepycat.dbxml.dbxml_javaJNI.XmlManager_query__SWIG_0(Native Method)
                                      at com.sleepycat.dbxml.XmlManager.query(XmlManager.java:544)
                                     at com.sleepycat.dbxml.XmlManager.query(XmlManager.java:320)
                                     at xmlirsystemstruxplus.XQueryEngine.queryEngine(XQueryEngine.java:269)
                                     at xmlirsystemstruxplus.XMLIRSystemStruXplus.main(XMLIRSystemStruXplus.java:109)
                                     Java Result: 1
        Note that i used  contains-any-of() function because the contains () function does not work with  'planet revenge 1998' string may be because the keywords do not appear in the order they appear in the element content.
       Please  can any body help me to find out  (1) why i have the  above error ? and solution  (2)  why  the condition contains  ( $entity/act/movie/title ,  'planet revenge 1998') is not working ? how do i use contains() function w.r.t this
    Thank you in advance
    Message was edited by: RokoA 19/01/2015  by RokoA

    Using the shell dbxml in both 2.5 and 6.0 I created a container and put the document example you gave into it.  Then I executed the following query:
    [code]
    declare namespace functx = 'http://www.functx.com';
    declare function functx:contains-any-of ( $arg as xs:string?, $searchStrings as xs:string* )  as xs:boolean {
    some $searchString in $searchStrings
    satisfies contains($arg,$searchString)
    for $entity in collection('simpleExampleData2.dbxml')//filmography
    where functx:contains-any-of ( $entity/act/movie/title ,  ('planet', 'revenge', '1998'))
    return $entity
    [/code]
    And got the results you expected instead of an error.
    Since you are using the Java API it is possible the problem is in how you configured and executed the query, instead of in the query itself.  If you could post an example program or code section that produces the error, then I can continue you help you with this.
    Lauren Foutz

  • Matcher vs. String.replaceAll

    I have been experiencing a problem attempting to use an expression such as:
    s = s.replaceAll("PATTERN","REPLACEMENT");
    to replace certain regular expressions in a document. When using the Matcher to replace Strings as follows there is no problem, but using the same pattern with String.replaceAll doesn't seem to perform the replacement.
    Pattern pattern = Pattern.compile("PATTERN",Pattern.DOTALL);
    Matcher matcher = pattern.matcher(s);
    s = matcher.replaceAll("REPLACEMENT");
    The only thing I can think of is that the Pattern.DOTALL options allows the match to take succeed, where it wouldn't otherwise. Therefore I was wondering if there an equivalent for the String.replaceAll method perhaps? Any ideas?
    Thanks very much,
    Ross Butler

    I'm having trouble believing that PATTERN and REPLACEMENT are the real string you're using, but it's probably not important, since it sounds like you probably diagnosed the problem yourself.
    According to the Javadocs, replaceAll gives the same result as Pattern.compile(regex).matcher(str).replaceAll(repl), but obviously that wouldn't necessarily be true if you add extra parameters somewhere in there, so I would say that replaceAll is more of a convenience method that you use when you don't need any extra parameters.
    However, if you need to use DOTALL or something else similar, you'll need the longer way using Matcher.
    That shouldn't stop you from writing your own convenience method, though. :)

  • Match a data string in each record of two text files

    What is the easiest way to match a string of characters in each record of File1.txt with the same string in File2.txt and write out those records that match from File1.txt to File3.txt? I don't want to buy an expensive application and I don't want to write a script from scratch.
    Thanks

    Take a look at the diff utility in the Terminal. A google search for it should provide enough info on how to use it. Basic is diff file1 file2
    Or, type "info diff" in the command line.
    Oops. I read too much into your request and got it backwards. Seems grep or awk would work for what you want.
    Message was edited by: Barney-15E

  • Closest Match algorithm using Strings..

    Hi all,
    I am wondering if there is any built in mechanism, or if not, any thought on how to get find a "close" match in a list of Strings, given a String and a set number of characters to match from the start of the String. Basically I have a combo box of items, and the user selects a file with "source" items. I try to display the "closest" match, if possible, if not an exact match, by looping through the x number of characters and so forth. With this being a JDK 1.4 application, I am curious to know if it is possible to do this using Regular Expressions, and if so, how would it be done? I haven't figured out Reg Expressions at this point. My immediate need is up to 3 characters matching, so in a name list of Jody, John, and Johnson, with a String of Joh, the John item would be returned as the closest match. If the String is ABC given the same list, then nothing is returned. It must be at least the first character matching, otherwise null is returned.
    Thanks for any help.

    Thanks. I'll look it up. I actually got it somewhat working. I basically have a list of items. I pass that list with the specific character and position of that character to match. It returns a List of all items that have the passed in character at the specific position. I then do it again for the next character, in a loop. In my case, I am only looking for the first 3 characters to be a match. That gets us a "close enough" situation where the user can then try to pick from there.
    Thanks for your input.

  • How to match up similar strings?

    Hello all,
    I have two tables that have supplier names in them. Some names are similar, but not perfect, so I can't do a name = name command. Here is the code that will help you understand what I'm asking about.
    create table abc (supp_cd varchar2(50),
                      supp_nm varchar2(50));
    create table xyz (supp_cd varchar2(50),
                      supp_nm varchar2(50));
    insert into abc values ('12345', 'KROGER');
    insert into abc values ('23456', 'WALMART');
    insert into abc values ('34567', 'KMART');
    insert into abc values ('45678', 'BEST BUY');
    insert into xyz values ('12345', 'KROGER INC');
    insert into xyz values ('23456', 'THE WALMART CO');
    insert into xyz values ('34567', 'KMART');
    insert into xyz values ('45678', 'BST BUY');
    select abc.supp_cd as abc_supp_cd, abc.supp_nm as abc_supp_nm, xyz.supp_cd as xyz_supp_cd, xyz.supp_nm as xyz_supp_nm
    from abc join xyz on abc.supp_cd = xyz.supp_cd
    where abc.supp_nm like xyz.supp_nm;Right now, my code is giving me only:
    ABC_SUPP_CD         |ABC_SUPP_NM         |XYZ_SUPP_CD         |XYZ_SUPP_NM         |
    34567               |KMART               |34567               |KMART               |When I want:
    ABC_SUPP_CD         |ABC_SUPP_NM         |XYZ_SUPP_CD         |XYZ_SUPP_NM         |
    12345               |KROGER              |12345               |KROGER INC          |
    23456               |WALMART             |23456               |THE WALMART CO      |
    34567               |KMART               |34567               |KMART               |
    45678               |BEST BUY            |45678               |BST BUY             |I'm not even sure if this is possible, but can someone steer me in the right direction to get similar names that match up?
    Thanks ahead of time guys.
    PS. I'm running Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    Hi,
    For a similar problem, I wrote once a function that returned a number between 0 and 100, reflecting how much 2 strings had in common (100 meant the strings were identical, 0 meant they didn't seem similar at all). Given such a function, you can match rows where the anmes were similar like this:
    FROM    abc
    JOIN      xyz  ON   abc.supp_cd  = xyz.supp_cd
              AND  nm_similiar (abc.supp_nm, xyz.supp_nm)  >= 70The nm_similar function would start by standardizing the 2 given names, e.g. converting to all capital letters, removing punctuation, and removing words such as 'THE' that you want to ignore. You may not want to ignore words like 'CO', but you probably do want to standardize them, so that 'COMP', 'CMPNY', 'CPY' and 'COMPANY' all turn into 'CO'. I made a separate function for standardization. I also corrected some common mispellings in the standardizaion function. For example, one company was actually named 'HUSQVARNA', but, more often than not, people added a 'U' right after the 'Q'.
    Once you've got the names standardized, you can use functions from utl_match to see how similr they are.

  • Match between two strings of which one may occur often in python

    I get a large swab of output from pacman -Qi. This output is piped using subprocess and converted to a string using str.decode. This all works.
    But then I would like to be able to cut a a block related to one package out of that large swap of output, like this:
    Name : steam
    Version : 1.0.0.25-3
    URL : http://steampowered.com/
    Licenses : custom
    Groups : None
    Provides : None
    Depends On : bash desktop-file-utils hicolor-icon-theme curl dbus
    freetype2 gdk-pixbuf2 ttf-font zenity lib32-libgl
    lib32-gcc-libs lib32-libx11
    Optional Deps : lib32-ati-dri: for open source ATI driver users
    lib32-catalyst-utils: for AMD Catalyst users
    lib32-intel-dri: for open source Intel driver users
    lib32-nouveau-dri: for Nouveau users
    lib32-nvidia-utils: for NVIDIA proprietary blob users
    lib32-flashplugin: for flash video, copy to
    $XDG_DATA_HOME/Steam/ubuntu12_32/plugins/
    Required By : None
    Conflicts With : None
    Replaces : None
    Installed Size : 6424.00 KiB
    Packager : Daniel Wallace <danielwallace at gtmanfred dot com>
    Architecture : x86_64
    Build Date : Fri Feb 8 21:51:42 2013
    Install Date : Mon Feb 11 11:35:09 2013
    Install Reason : Explicitly installed
    Install Script : Yes
    Description : Digital distribution client - open beta - bootstrap package
    The goal is to search the large swab of output for a package installed on a specific install date.
    I've tried many kinds of pattern matching but I cant seem to wrap my head around it. Does anyone know a short, sweet, fast, clean way to do this?
    Greetings
    Last edited by welpert (2013-02-11 16:59:24)

    #!/usr/bin/env python
    # -*- coding: UTF-8 -*-
    import re, sys
    pacman_data = sys.stdin.readlines()
    for line in pacman_data:
    match = re.search( "^install date[ \t]*: (.*)", line, re.I )
    if match: print( match.group( 1 ))

  • Matcher replaceAll vs String replaceAll and + plus sign anomaly?

    I have code that is to highlight search terms found within a given string.
    I searched within a given string "Java, C++, C, etc." for the term "C++" and have really strange results.
    Below is a snippet.
    // Now the highlighting portion              
                /** The temporary start tag, just some uncommon Unicode character. */
                final String START_TAG = Character.toString( (char)0x0141 );
                /** The temporary end tag. */
                final String END_TAG = Character.toString( (char)0x0142 );
                String highlighted = result.toString();
                for (int m = 0; m < foundPhrases.size(); m++) {
                    String phrase = foundPhrases.get(m);
                    String pattern = "[^" + START_TAG + "](" + phrase + ")";
                    Pattern firstMatchedPattern = Pattern.compile( pattern, Pattern.CASE_INSENSITIVE );
                    Matcher matcher = firstMatchedPattern.matcher( highlighted );
                    while( matcher.find( ) ) {
                        String foundPhrase = matcher.group( 1 );
                        StringBuffer hilitebuffer = new StringBuffer( START_TAG );
                        hilitebuffer.append( foundPhrase ).append( END_TAG );
                        System.out.println("hilitebuffer = " + hilitebuffer.toString());
                        //highlighted = matcher.replaceAll(hilitebuffer.toString());
                        highlighted = highlighted.replaceAll( foundPhrase, Matcher.quoteReplacement(hilitebuffer.toString( ))); also cannot handle +
                        System.out.println("highlighted= " + highlighted);
                    highlighted = highlighted.replaceAll( START_TAG,
                          CoreServices.highlightTagStart );
                    highlighted = highlighted.replaceAll( END_TAG, CoreServices.highlightTagEnd );
                System.out.println( "highlightMatchingPhrases.return: " + highlighted );
                return highlighted;Using String's replaceAll to assign highlighted, I get:
    hilitebuffer = ?C++?
    highlighted= Java, ?C++?++, ?C++?, etc.
    highlightMatchingPhrases.return: Java, <b style="color:black;background-color:#ffff66">C++</b>++, <b style="color:black;background-color:#ffff66">C++</b>, etc. Note the extra ++ and C++
    Using Matcher's replaceAll, I get:
    hilitebuffer = ?C++?
    highlighted= Java,?C++?, C, etc.
    highlightMatchingPhrases.return: Java,<b style="color:black;background-color:#ffff66">C++</b>, C, etc.
    Problem here is very subtle, the space preceeding the text C++ has been replaced as well. So, if the text string was "rollerblading" and the search term was "blading" the resulting highlighted text would be rolleblading, missing the r. Not good.
    Reproducible every time.
    Ideas?
    Thanks!
    Ginni

    First, ginnibobinni, you can't use HTML to format text in these forums. To get text in bold, you can use one of these approaches: text or *text* I prefer the square-bracket form; the asterisks are just too finicky.
    sabre150 wrote:
    I'm not inclined to go though that convoluted program in any detail but I will say that you should quote using \Q and \E the phrase in String pattern = "[^" + START_TAG + "](" + phrase + ")"
    I started to point out all of the errors in that code, but the task was just too daunting. ;)
    Instead, here's a bit of code that seems to do what you want: import java.util.*;
    import java.util.regex.*;
    public class Test
      static final String START_TAG = "\u0141";
      static final String END_TAG = "\u0142";
      public static void main(String[] args) throws Exception
        List<String> phrases = Arrays.asList("Java", "C++");
        String input = "Java, C++, C";
        String output = input;
        for (String phrase : phrases)
          String regex = "(?<=^| )\\Q" + phrase + "\\E(?=,|$)";
          Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
          Matcher m = p.matcher(output);
          StringBuffer sb = new StringBuffer();
          while (m.find())
            m.appendReplacement(sb, "");
            sb.append(START_TAG).append(m.group()).append(END_TAG);
          m.appendTail(sb);
          output = sb.toString();
        System.out.println(output);
    } Any questions? :D

  • A php search engine that only shows results that match entire serch string

    I have set up a dreamweaver search engine through php and a fulltext search (WHERE MATCH (....) AGAINST (...). However, when someone inputs more than one word into the search form, the search engine churns out results that only have one of those words. How do I get it to only show results that have all the search string words inside? (or, at least, how do I get those results to show up at the top?)
    I have seen some advice (here) that uses php code to process the search query, divide up the words, and place a BOOLEAN '+' between each of the words. By doing this, the search engine will only show results that fully match all the terms.
    My problem is that I do not know how to put this code into my Dreamweaver-created code.
    My dreamweaver created code:
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $form_rsSearch = "-1";
    if (isset($_get['search'])) {
      $form_rsSearch = $_get['search'];
    mysql_select_db($database_dataConnect, $dataConnect);
    $query_rsSearch = sprintf("SELECT title, content FROM encyclopedia WHERE MATCH (title, content) AGAINST (%s)", GetSQLValueString($form_rsSearch, "text"));
    $rsSearch = mysql_query($query_rsSearch, $dataConnect) or die(mysql_error());
    $row_rsSearch = mysql_fetch_assoc($rsSearch);
    $totalRows_rsSearch = mysql_num_rows($rsSearch);
    $input_rsSearchResults = "-1";
    if (isset($_GET['search'])) {
      $input_rsSearchResults = $_GET['search'];
    mysql_select_db($database_EMdataConnect, $dataConnect);
    $query_rsSearchResults = sprintf("SELECT title, content FROM encyclopedia WHERE MATCH(title, content) AGAINST(%s)", GetSQLValueString($input_rsSearchResults, "text"));
    $rsSearchResults = mysql_query($query_rsSearchResults, $dataConnect) or die(mysql_error());
    $row_rsSearchResults = mysql_fetch_assoc($rsSearchResults);
    ?>
    and the code the website (link above) gives is:
    function search(String $search_string) {
         //strip Boolean search characters out of search string
         $search_string = string_replace($search_string,"+","");
         $search_string = string_replace($search_string,"-","");
         $search_string = string_replace($search_string,"*","");
         //split the search string up into an array of words
         Array $tokenized_search = split($search_string, " ");
         //init an empty final search string
         String $processed_search = "";
         //for each word in the search, wrap it
         //with an + and * character and then append
         //it to the processed_search variable
         foreach($tokenized_search as $token) {
              $processed_search+="+"+$token+"* ";
         //build the sql for the query and query the DB
         String $db_query = "select id, description
              from product_descriptions
              where MATCH(description)
              AGAINST ('"+$processed_search+"' IN BOOLEAN MODE)";
         Array results = execute_database_query($db_query);
         return results;
    If anyone can instruct me on the correct way to go about this, I would be very much obliged.
    Thank you,
    YWSW

    Don't use the Search bar, type the address in the Location bar.

  • Find files that match with given string, except one character in a fixed position

    Hi,
    I want to find files in a directory with a given string (ss-20140129-process-000*.sdx), where only one character will be mismatched, so have to use wildcard for that character. This means I am looking for filenames where everything needs to be matched except
    one character in position of "*". For the samples given below: 1st 3 files matched with the given string, but last 3 files have not matched, so first 3 files will be counted.
    ss-20140129-process-0001.sdx
    ss-20140129-process-0004.sdx
    ss-20140129-process-0009.sdx
    zx-20140129-process-0001.sdx
    bt-20140129-process-0002.sdx
    zx-20140129-process-0001.sdx
    I can use the command like (GCI -path $folder -filter ss-20140129-process-000?.sdx), BUT problem is i am building a string for the filter (code given below), where i DO NOT know how to use "?" within the string to make a character exception.
    Code:
    $datevalue = [datetime]::parseexact($trandate,"MMddyy",$null)
    $yyyymmdd = $datevalue.tostring('yyyyMMdd')
    $FileToCheck = ("ss-"+$yyyymmdd+"-process-000?.sdx")
    GCI -path $folder -filter $FileToCheck
    But it's definitely NOT working for syntax problem.
    Any help?

    I don't think it's a syntax issue in the filter.  This works fine for me:
    $yyyymmdd = '20140129'
    $FileToCheck = ("ss-"+$yyyymmdd+"-process-000?.sdx")
    Get-ChildItem -Path . -Filter $FileToCheck
    <#
    Output:
    Directory: C:\source\Temp\sdxtext
    Mode LastWriteTime Length Name
    -a--- 1/30/2014 10:16 AM 0 ss-20140129-process-0001.sdx
    -a--- 1/30/2014 10:16 AM 0 ss-20140129-process-0004.sdx
    -a--- 1/30/2014 10:16 AM 0 ss-20140129-process-0009.sdx
    #>
    You can try adding some debug output right before the call to Get-ChildItem. Check the values of $Folder and $FileToCheck, make sure they're correct. You can also fiddle with the values and call Get-ChildItem manually until it works, which would then tell you
    how the code needs to be changed.

  • Install, Match (X) or Copy, Merge all below and Copy all below

    Hi,
    Can any one please tell me when can we use only "Install", combination of both "Install and Match (X) or Copy" and only "Match (X) or Copy" Indicatiors.
    And what is Match (x) or Copy, are they different from each other or they are one and same? if there is difference what is the diff between Match (x) and Copy.
    And what is the use of "Merge All Below" and "Copy All Below" in the context menu of the objects that are collected.
    Regards,
    Kumar.

    Hi,
    Install
    -> Objects that are being transferred for the first time. There is not an active version of these objects in the system.
    ->Business Content objects that have been redelivered in a new version. These objects are identified by the Content time stamp in the corresponding object tables.
    Match (X) or Copy
    If the SAP delivery version and the active version can be matched, a checkbox is displayed in this column.With the most important object types, the active version and the SAP delivery version can be matched.
    The Match indicator is set as default in order to prevent the customer version being unintentionally overwritten. If the Content of the SAP delivery version is to be matched to the active version, you have to set the Install indicator separately.
    The active version is overwritten with the delivery version if
    -> the match indicator is not set and
    -> the install indicator is set.
    In other words, the delivery version is copied to the active version.
    If the Install indicator is not set, the object is not copied or matched. In this case, the Match indicator has no effect.
    In the context menu, two options are available:
    a.      Merge All Below
    The object in the selected hierarchy level and all objects in the lower levels of the hierarchy are selected as to Match.
    b.      Copy All Below
    The Match indicators are removed for the object in the selected hierarchy level and all objects in the lower levels of the hierarchy. If the Install indicator is also set, these objects are copied from the delivery version to the active version.
    The most important properties which are taken into account when versions are matched are now listed.
    For further information check this link [Installing Business Content |http://help.sap.com/saphelp_nw04/helpdata/en/80/1a66d5e07211d2acb80000e829fbfe/content.htm]
    Hope this helps....
    Rgs,
    Ravikanth.

  • Pattern matching for an expression

    How do I do a pattern matching for a strings that look like the ones below?
    11 1
    12 12
    1 34
    Thanks

    >
    "[^[0-9]|^RATE]";
    "[\\d\\d\\d\\d\\d\\d\\d|\\w\\w\\w\\w\\w\\w\\p{Punct}\\w
    \w\\p{Punct}\\w|[RATE]]";
    I have the above two patterns to match. I want to
    combine these two and say this and that. How do I use
    an and in between. I tried the following and it didn't
    work.
    "[^[0-9]|^RATE][\\d\\d\\d\\d\\d\\d\\d|\\w\\w\\w\\w\\w\\
    \\p{Punct}\\w\\w\\p{Punct}\\w|[RATE]]";
    Any help?I think you'd do better to give us examples of the text you're trying to match, because none of those patterns makes any sense.

  • Using a SQL Query in an Alert and Matching a String

    I've created an alert in 12.0.4 using a SQL Query and the field that I'm trying to match is a string.  Originally the query returned multiple rows but when the alert still didn't fire, I modified the query WHERE clause to return only one row:
    NAME                                RESPONSE
    Are area lights working?            No
    My expression in the metric is RESPONSE.  In the Monitor I'm matching a string equal to No.  (Do I need double quotes around the matchvalue?  Single quotes?  No quotes?)  The metric is in the 15min scan group, the role is xMII Developers and I'm in that role. The monitor alert string is ' =  '.  Both metric and monitor are active and I've subscribed to the monitor.  Other alerts in the 15min scan group (all based on tag queries) are firing off properly.
    Why is nothing showing up in the Alert Log?
    David Macindoe

    David,
    Did you figure out the answer?  If not, I will try to find someone to address your question.
    Mike

  • Get all groups from a regular expression match

    Please help me understand how to use Java regular expressions:
    I have an expression similar to this:
    {noformat}"([^X]+)(X[^X]*)+"{noformat}This should match stuff like "asaasaXdfdfdfXXsdsfd".
    How does one access all the matches for the second group (the second groups has a Kleene operator
    added so it is not really just one group --- but match.groupCount() is always 2)
    Here is roughly the code:
    {noformat}java.util.regex.Pattern pattern = {noformat}{noformat}java.util.regex.Pattern.compile({noformat}{noformat}"([^X]+)(X[^X]*)+",{noformat}{noformat}java.util.regex.Pattern.MULTILINE{noformat}{noformat});{noformat}{noformat}java.util.regex.Matcher matcher = pattern.matcher(text);{noformat}{noformat}matcher.find();{noformat}{noformat}int groupcount = matcher.groupCount();{noformat}
    Also, without matcher.find() I get an illegalStateException .. which I also get if I use matcher.matches() instead
    of matcher.find().
    I am obviously missing something here. There is always at least one "X" in the string so shouldn't that pattern always
    match the whole string? Since there are often multiple X, shouldnt I get a group for each occurrence of X, followed
    by 0 or more other characters?
    {noformat}But when I try to match everything by using "^([^X]+)(X[^X]*)+$" I get an "IllegalStateException: No match available" again.{noformat}
    What is the correct way to do this?
    Edited by: johann_p on May 16, 2008 10:39 AM

    I am sorry I messed this up. Here is a SSCCE:
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;
    class RegExp1 {
        public static void main(String[] args) {
          String testString = "first|aaaa | bbbb\n|cccc|ddddd";
          Pattern pattern = Pattern.compile("^([^|]+)(\\|[^|]*)+$");
          Matcher matcher = pattern.matcher(testString);
          matcher.find();
          int groupcount = matcher.groupCount();
          System.out.println("Found "+groupcount+" groups");
          System.out.println("Matcher: "+matcher);
          for (int i = 1; i <= groupcount; i++) {
            System.out.println("Match "+i+": "+testString.substring(matcher.start(i),matcher.end(i)));
    }I figured out a small bug in my first code that explains some of the exception oddities, but my principal question remains:
    how do I access all the matches that correspond to the second capturing group?
    In the example I would get "first" for Match 1 and "|ddddd" for Match 2, but how do I access all the matches??
    Thank you for your help!

  • Regular expression question - match a template

    Hello All!
    I've put regex patterns to simple use b4, but this one I'm finding a bit of a challenge.
    I need to match lines to the following template:
    "9############ ###9,99 XXXXX####9,99 #9"In this template 9s mean digits, Xs mean alphanum characters and the #s mean optional digits.
    For example the following strings must mutch the above pattern:
    1. "123             18,10 abcde    9,99  1"
    2. "1234567890123 1000,99 CCCCC  260,99  2"This is the regex I came up with so far.
    "^[ \\d]{13}? [ \\d]{3}?\\d,\\d\\d .{5}?[ \\d]{4}\\d,\\d\\d [ \\d]\\d$"The problem with it of course is that it will match a string like:
    1. "9            9  9 ,99 abcde  9 9,99  1"Basically, the question is whether it is possible to ensure that when the optional digits are
    not present, they have the required spaces in their positions.
    Any help is much appreciated.
    P.s. the reason I am trying to use regex instead of splitting the string and validating the tokens
    separately is because I have a number of such templates to validate lines against, and each template signals a particular line type. :) Basically I need to decide what type of line is it I just read from a file...
    Thnx.

    First of all, isn't the first digit mandatory?
    That would mean that the first part of your regex should be:"^\\d"followed by 12 characters that can be either ' ' or any digit:"^\\d[ \\d]{12}"followed by space, three spaces or digits and a digit"^\\d[ \\d]{12} [ \\d]{3}\\d"comma, two digits, space, five alphanums"^\\d[ \\d]{12} [ \\d]{3}\\d,\\d{2} [\\w[^_]]{5}"4 space or digit, digit, comma, 2 digits"^\\d[ \\d]{12} [ \\d]{3}\\d,\\d{2} [\\w[^_]]{5}[ \\d]{4}\\d,\\d{2}"space, space or digit, digit, the end"^\\d[ \\d]{12} [ \\d]{3}\\d,\\d{2} [\\w[^_]]{5}[ \\d]{4}\\d,\\d{2} [ \\d]\\d$"And please note that the string you provided"9            9  9 ,99 abcde  9 9,99  1"is not supposed to match but the string"9                9,99 abcde    9,99  9"will.

Maybe you are looking for

  • Finding and selecting (ticking) items in one shot in ZSDE_DNP - SAP SD

    Hi all, i am new here, looking for your supports, i have a small issue in the SAP SD module in the ZSDE_DNP screen. i want to select only 10 items randomly from around 100 items to process the delivery note, for this i have to first find that item us

  • How to handle user entered data validation

    Hi, In my page i have three fields Empname (String) Empnumber (Number) DOB (Date) These fields are mapped to VO which are mapped to EO. When user enters string in Empnumber field then it will throw user following Error "Cannot create an object of typ

  • Outgoing Payment File Format for US

    Is there a default file format available for exporting payments to a file for the US? I have a customer with this requirement and with my lack of understanding of US requirements, it will take me a long time to create one from start. I would apprecia

  • Reg: ALE settings in SAP R3 system

    Hai            I am Kiran. I want to know complete details about ALE settings.            Can any one send necessary documents regarding these settings. Thanks Kiran

  • If i reinstall itunes can i keep my old library?

    Hi, i have had to reinstall itunes via my window 7 pc as corrupted etc... can i retrieve my old library with 1500 songs on it?!!