A regular expressin problem: String.matches & the pair of Pattern & Matcher

I observe this problem when working on pattern match for Z5Z-5Z5, Z5Z 5Z5 or Z5Z5Z5.
When I use the match method of the String class, the correct pattern will yield true with
!str.matches("^[A-Za-z]\\d[A-Za-z]\\s?|-?\\d[A-Za-z]\\d$").
When I use the pair classes of regex:
Pattern p = Pattern.compile("^[A-Za-z]\\d[A-Za-z]\\s?|-?\\d[A-Za-z]\\d$");
Matcher m = p.matcher(str);
a string of "v7u h4e" (two blank spaces in between) can pass the !m.find().
Have anyone else experienced the same situation?
Do I use them right, or bugs?
Thanks for your input.
v.

This is why I wish regex references would list the
operator precedence. What do you mean? My regex reference does show that right under the section called "Operators" in the second chapter.
Maybe you need to update your references and buy "Programming Perl"? :)
I think there are only three
levels of precedence, but it needs to be crystal clear
that | has the lowest precedence (even lower than
putting two tokens together!) and often needs
parentheses: "\w\d|\s\w" means "(\w\d)|(\s\w)", not
"\w(\d|\s)\w".Actually for that particular operator it is pretty consistent. It is always very low. Even when I was introduced to the theory of regex's in school the precedence was lower than everything else.

Similar Messages

  • How to use Labview to output the coordinates from Pattern Matching result

    I tried to add some labview commands into the vi program created by IMAQ Pattern Matching scrip to output the coordinates of a target point found in Pattern Matching because i need to do some calculations for the point coordinates and I don't want just to read the values from the IMAQ results on the monitor. Does anyone can help me? Thank you.
    Attachments:
    PatternMatching1.vi ‏84 KB

    I have posted replies to your other postings with your same question, and continue to recomend that you look at some of the LabVIEW tutorials.
    I modified the attched program such that it would index the arrays of match information returned and then unbundle the X and Y features of the match and add them to gether as an example of how to access the data programatically.
    I hope this helps.
    Regards,
    Amaury Rolin
    NI Applications Engineer
    Attachments:
    PatternMatching_mod.vi ‏88 KB

  • Retain Pattern Match Attribute for Next Pattern Match Calculation

    When a MATCH_RECOGNIZE PATTERN match occurs, is there any way to retain the underlying event for the next pattern match?
    It's like I want to replay the underlying event (that triggered the match) into the next "batch" of events.

    Here is an approach
    1) Use a (local) cache to hold the "lastMatchedTime"
    2) Augment each input event with the "lastMatchedTime" by first (left outer join) joining with cache
    3) Run the MATCH_RECOGNIZE on the augmented stream
    4) Use a match to update the cache
    Here are the queries that I tried -
      <view id="S">
            <![CDATA[
                 RSTREAM (
                    SELECT
                           id,
                           obs,
                           epoch,
                           nvl(C.lastMatchedTime, 0) as lastMatchedTime
                    FROM
                           InputChannel[now] AS I LEFT OUTER JOIN lastMatchCache AS C
                    ON
                           C.keyValue = "key"      
            ]]>
          </view>
          <view id="v1">
            <![CDATA[                 
                      SELECT
                              T.id,
                              T.obsTotal,
                              T.elapsedTime,
                              T.firstts,
                              T.lastts
                      FROM S MATCH_RECOGNIZE (
                              PARTITION BY id
                              MEASURES
                                        id as id,
                                        sum(obs) as obsTotal,
                                        B.epoch - decode(B.lastMatchedTime, 0L, min(epoch), B.lastMatchedTime) as elapsedTime,
                                        decode(B.lastMatchedTime, 0L, min(epoch), B.lastMatchedTime) as firstts,
                                        B.epoch as lastts
                              PATTERN ( A+? B )
                              DEFINE
                                       B AS (epoch- decode(lastMatchedTime, 0L, min(epoch), lastMatchedTime)) > 20*60*1000
                      ) as T
            ]]>
          </view>
          <query id="qcache">
             <![CDATA[
                 SELECT
                       "key" as keyValue,
                       lastts as lastMatchedTime
                 FROM
                       v1
             ]]> 
          </query>
           <query id="q1">
             <![CDATA[
                 SELECT
                 FROM
                        v1
             ]]> 
          </query>
        Also, include in the config file
    <channel>
           <name>CacheChannel</name>
           <selector>qcache</selector>
       </channel> 
       <channel>
           <name>OutputChannel</name>
           <selector>q1</selector>
       </channel>The EPN that I used was
      <wlevs:event-type-repository>       
            <wlevs:event-type type-name="CacheEvent">
                <wlevs:class>com.bea.wlevs.event.example.helloworld.CacheEvent</wlevs:class>
            </wlevs:event-type>
            <wlevs:event-type type-name="InputEvent">
               <wlevs:properties>
                  <wlevs:property name="id" type="int"/>
                  <wlevs:property name="obs" type="int"/>
                  <wlevs:property name="epoch" type="bigint"/>
               </wlevs:properties>
            </wlevs:event-type>
            <wlevs:event-type type-name="OutputEvent">
               <wlevs:properties>
                  <wlevs:property name="id" type="int"/>
                  <wlevs:property name="obsTotal" type="int"/>
                  <wlevs:property name="elapsedTime" type="bigint"/>
                  <wlevs:property name="firstts" type="bigint"/>
                  <wlevs:property name="lastts" type="bigint"/>
               </wlevs:properties>
            </wlevs:event-type>
        </wlevs:event-type-repository>
        <wlevs:adapter id="InputAdapter" provider="csvgen">
             <wlevs:instance-property name="port" value="9061" />
             <wlevs:instance-property name="eventTypeName" value="InputEvent" />
             <wlevs:instance-property name="eventPropertyNames" value="id,obs,epoch" />
        </wlevs:adapter>     
        <wlevs:channel id="InputChannel" event-type="InputEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
            <wlevs:source ref="InputAdapter"/>
        </wlevs:channel>
        <wlevs:caching-system id="local-caching"/>
        <wlevs:cache id="lastMatchCache" name="lastMatchCache" key-properties="keyValue" value-type="CacheEvent">
           <wlevs:caching-system ref="local-caching"/>
        </wlevs:cache>
        <!-- The default processor for OCEP 11.0.0.0 is CQL -->
        <wlevs:processor id="helloworldProcessor">
           <wlevs:listener ref="CacheChannel"/>
           <wlevs:cache-source ref="lastMatchCache" />      
        </wlevs:processor>
        <wlevs:channel id="CacheChannel" event-type="CacheEvent">
           <wlevs:listener ref="lastMatchCache"/>
        </wlevs:channel>
        <wlevs:channel id="OutputChannel" event-type="OutputEvent" advertise="true">
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
            <wlevs:source ref="helloworldProcessor"/>
        </wlevs:channel>And the output that I get seems to match your requirement -
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=9, v1.elapsedTime=7228000, v1.firstts=1199311210000, v1.lastts=1199318438000
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=17, v1.elapsedTime=30935000, v1.firstts=1199318438000, v1.lastts=1199349373000
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=7, v1.elapsedTime=41436000, v1.firstts=1199349373000, v1.lastts=1199390809000
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=13, v1.elapsedTime=5904000, v1.firstts=1199390809000, v1.lastts=1199396713000Edited by: Anand Srinivasan on Sep 30, 2010 12:49 AM
    Edited by: Anand Srinivasan on Sep 30, 2010 12:50 AM

  • Provincial Sales Tax (PST) on Purchases should match the Item expense

    PST on purchases is not an input tax credit and should be treated as an expense.  The system is set up to do that but the problem is that the PST expense should match the item expense.  The way it is set up now, no matter what the item expense (or even if it is a capital item) the PST is always expensed to account - PST on Equipment Use & Parts.  Is there any way to manage this so the PST expense matches the item expense?  An issue we see in Enprise Job costing is that PST is expensed in A/P while the item is expense in Enprise when the costs are posted to the job.  Costs may not be posted to a job for months (until revenue is recognized).  We therefore also have matching (revenues to expenses) problem

    We are a Canada company in Marine and Industrial industry. We have the same problem!
    What I am doing right now is to generate a template (percentage) and use this template whenever I should record PST.
    Template 1:
    Inventory 100%
    Inventory (for PST) 8%
    GST Payable 5%
    Template 2:
    Office Expense 100%
    Office Expense (for PST) 8%
    GST Payable 5%
    Is there any easier way? We have a lot of accounts need PST, such as WIP. How to change the mapping to make things easier? Thanks!

  • New language feature: lazy local pattern matching

    <p>In the upcoming release of the Open Quark Framework, CAL gets a new language       feature: lazy local pattern matching.</p> <p>The new local pattern match syntax allows one to bind one or more variables to       the fields of a data constructor or a record in a single declaration inside a       let block.</p> <p>      For example:</p> <p>      // data constructor patterns:<br />      public foo1 = let Prelude.Cons a b = ["foo"]; in a;<br />      public foo2 = let Prelude.Cons {head=a, tail=b} = ["foo"]; in a;<br />      <br />      // list cons patterns:<br />      public foo3 = let a:b = [3]; in a;<br />      <br />      // tuple patterns:<br />      public foo4 = let (a, b, c) = (b, c, 1 :: Prelude.Int); in abc;<br />      <br />      // record patterns:<br />      public foo5 = let = {a = "foo"}; in a; // non-polymorphic record pattern<br />      public foo6 = let {_ | a} = {a = "foo", b = "bar"}; in a; // polymorhpic record       pattern<br />      <br />      Whereas a case expression such as (case expr of a:b -> ...) forces the       evaluation of expr to weak-head normal form (WHNF), a similar pattern match       declaration (let a:b = expr; in ...) does not force the evaluation of expr       until one of a or b is evaluated. In this sense, we can regard this as a form       of lazy pattern matching.<br /> </p> <p>Thus,</p> <p>      let a:b = []; in 3.0;</p> <p>is okay and would not cause a pattern match failure, but the case expression</p> <p>      case [] of a:b -> 3.0;</p> <p>would cause a pattern match failure.</p> <p>This laziness is useful in situations where unpacking via a case expression may       result in an infinite loop. For example, the original definition of List.unzip3       looks like this:</p> <p>// Original implementation of List.unzip3<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  ys =       unzip3 xs;<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      //do       not do a "case" on the ys, since this makes unzip3 strictly evaluate the list!<br />                      (x1       : field1 ys, x2 : field2 ys, x3 : field3 ys);<br />              ;<br />          ;<br /> </p> <p>The use of the accessor functions field1, field2 and field3 here is necessary,       as the alternate implementation shown below would result in "unzip3 xs" to be       evaluated to WHNF during the evaluation of "unzip3 (x:xs)". Thus if the input       list is infinite, the function would never terminate. </p> <p>// Alternate (defective) implementation of List.unzip3<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  ys =       unzip3 xs;<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      case       ys of // the use of "case" here is inappropriate, as it causes "unzip3 xs" to       be evaluated to WHNF<br />                      (y1,       y2, y3) -> (x1 : y1, x2 : y2, x3 : y3);<br />                  ;<br />              ;<br />          ;<br /> </p> <p>With the new syntax, the original implementation can be expressed more nicely       without changing its semantics:</p> <p>// New implementation of List.unzip3, revised to use the local pattern match       syntax<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  (y1,       y2, y3) = unzip3 xs; // using a tuple pattern to perform a lazy local pattern       match<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      (x1       : y1, x2 : y2, x3 : y3);<br />              ;<br />          ;<br /> </p> <p style="text-decoration: underline">It is important to note that in places where       a case expression can be used (without having an unwanted change in the       laziness of the expression being unpacked), it should be used instead of this       local pattern match syntax.</p> <p>Things to note about the new syntax:</p> <p>      - local type declarations on the pattern-bound variables are allowed, and these       type declarations can have associated CALDoc comments. On the other hand, the       actual local pattern match declaration itself cannot have a type declaration       nor a CALDoc comment.</p> <p>      - this syntax cannot be used for top-level definitions, only local definitions       in let blocks</p> <p>      - one cannot use patterns with multiple data constructors, e.g.</p> <p>      let (Left|Right) = ...;</p> <p>      is not allowed</p> <p>      - one cannot specify a variable for the base record pattern, e.g.</p> <p>      let {r | a, b} = ...;</p> <p>      is not allowed, but this is okay:</p> <p>      let {_ | a, b} = ...;</p> <p>      - patterns without no variables are disallowed, e.g.</p> <p>      let _ = ...;<br />      let [] = ...;<br />      let () = ...;<br />      let : = ...;<br />      let {_|#1} = ...;      <br /> </p>

    If you use just / it misinterprets it and it ruins
    your " " tags for a string. I don't think so. '/' is not a special character for Java regex, nor for Java String.
    The reason i used
    literal is to try to force it to directly match,
    originally i thought that was the reason it wasn't
    working.That will be no problem because it enforces '.' to be treated as a dot, not as a regex 'any character'.
    Message was edited by:
    hiwa

  • How do I set multiple pattern matching Vi's and make overlappin​g pattern matches to count as one?

    Hello! I'm a student and I'm currently making a project using pattern matching.
    My patterns are from chick foot/feet.
    I'm  created multiple pattern matching VI's to detect all the feet because I find it difficult/impossible to match all the feet with a single pattern/template.
    However, when using multiple pattern matching VI's some pattern matches detect the same foot, hence overlapping.
    So how can I make the overlaping pattern matches to be counted as one?
    Thank you in advance

    Thank you for replying Sir Zwired1.
    I'm still a newbie in using LabVIEW so pardon me if I can't understand fully
    The objective of my project is to detect all the feet through pattern matching and count the pattern matches made.
    "Keep a 2D array of counts, initialized to zero and the same size as your array of possible locations, and increment the value every time you get a match. If multiple pattern matching attempts result in a match a given location in your count array might be "3" but all you care about is if the number is greater than zero."
    I'm sorry, but how do you do this? BTW, I'm using vision assistant.

  • Color pattern match in consumer producer architecture

    The way I currently have my code is as follows:
    If the number of matches in a color pattern match is greater than 0, it sends the information to the consumer loop.
    If it is not greater than 0, it doesn't send anything.
    What I was wondering is, if it finds a match the first time and it sends the information to the consumer loop, will the number of matches in the color pattern match return to 0 or will it be greater than 0 after the first match? If the number of matches in the color pattern match will be greater than 0 after the first match, and it will still be greater than 0, even though it doesn't find a match in the following scenarios, how can I make the number of matches in the color pattern match return to 0?

    Fernan1988 wrote:
    ... will the number of matches in the color pattern match return to 0 or will it be greater than 0 after the first match?...
    it's hard to say unless you can post your code....have you tried probing tool,retain wire value,highlight execution,single stepping into and out, breakpoints?

  • Regular expressions and string matching

    Hi everyone,
    Here is my problem, I have a partially decrypted piece string which would appear something like.
    Partially deycrpted:     the?anage??esideshe?e
    Plain text:          themanagerresideshere
    So you can see that there are a few letter missing from the decryped text. What I am trying to do it insert spaces into the string so that I get:
                        The ?anage? ?esides he?e
    I have a method which splits up the string in substrings of varying lengths and then compares the substring with a word from a dictionary (implemented as an arraylist) and then inserts a space.
    The problem is that my function does not find the words in the dictionary because my string is only partially decryped.
         Eg:     ?anage? is not stored in the dictionary, but the word �manager� is.
    So my question is, is there a way to build a regular expression which would match the partially decrypted text with a word from a dictionary (ie - ?anage? is recognised and �manager� from the dictionary).

    I wrote the following method in order to test the matching using . in my regular expression.
    public void getWords(int y)
    int x = 0;
    for(y=y; y < buff.length(); y++){
    String strToCompare = buff.substring(x,y); //where buff holds the partially decrypted text
    x++;
    Pattern p = Pattern.compile(strToCompare);
    for(int z = 0; z < dict.size(); z++){
    String str = (String) dict.get(z); //where dict hold all the words in the dictionary
    Matcher m = p.matcher(str);
    if(m.matches()){
    System.out.println(str);
    System.out.println(strToCompare);
    // System.out.println(buff);
    If I run the method where my parameter = 12, I am given the following output.
    aestheticism
    aestheti.is.
    demographics
    de.o.ra.....
    Which suggests that the method is working correctly.
    However, after running for a short time, the method cuts and gives me the error:
    PatternSyntaxException:
    Null(in java.util.regex.Pattern).
    Does anyone know why this would occur?

  • How to match the nth word in a string?

    Hi, when I have a string like
    "AA BBBB CCC DDDDDD EEE FF"
    all words are of the form \w+
    and I'd like to match the nth word, for example the third would be "CCC",
    how can I establish this with just one regular expression?
    Some annotations:
    This is done with Java 1.4, but tools like the string tokenizer are not
    possible (restrictions of the application) We're limited to one regular expression!
    In Perl, one would do it this way:
    This would be the regular expression:
    "[\w+\s+\w+\s+](w+)"
    and with the help of $1, you might match the first paranthesis.
    As I said before, this is no solution here, because we're limited to one
    regular expression
    Another idea for Java Regex would be to define a positive lookahead, like (?<=\w+\s+\w+\s+), but as the width of it is variable, it is not allowed!
    Thanks for your help,
    Heiko Kubidsky

    well, i did another test class
    import java.util.regex.*;
    public class NthMatch {
    public static void main(String[] args) {
      Pattern p = Pattern.compile(
        "(?:\\w+\\s+){" + args[1] + "}(\\w+)(?:\\s.*)?");
      Matcher m = p.matcher(args[0]);
      if (m.matches())
       System.out.println(m.group(1));
      else
       System.out.println("no match");
    }run: java NthMatch "aa bb cc dd" 2
    does that help?
    what kind of framework you have to squeese the regex in?
    what do you want to do with that regex?
    do you want to check if Nth word maches something, or do you want to retriev that Nth string? or are you trying to do anything else?
    your explanation is unfortunatelly not sufficient :(

  • Large string into the VARCHAR2 field parsing problem

    Guys,
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    My problem is: The frontend of the application sends a large string into the VARCHAR2 (4000 BYTES) field.
    The string it sends is somewhat like the samples given below. I need to parse and put them in the tables
    as shown below. Please let me know, if you have any questions. -
    Crit: Some text1.
    Proficient (points 2): Some more text1.
    Comment1...........................................
    ..Comment1
    Crit: Some text2.
    Non-performance (points 0): Some more text2.
    Crit: Some text3.
    Distinguished (points 3): Some more text3.
    Crit: Some text4.
    Distinguished (points 3): Some more text4.
    Table 1
    Crit          points          comment        morecomment
    Some text1.     2           Some more text1. Comment1.............................Comment1
    Some text2.     0           Some more text2.
    Some text3.     3           Some more text3.
    Some text4.     3           Some more text4.
    Table 2
    Overall Comment
    Crit: Some text1.
    Proficient (points 2): Some more text1.
    Crit: Some text2.
    Non-performance (points 0): Some more text2.
    Crit: Some text3.
    Distinguished (points 3): Some more text3.
    Crit: Some text4.
    Distinguished (points 3): Some more text4.
    Overall comments:
    Blah2 Blah2 Blah2!
    Some more blah2 blah2 blah2.
    Table 1
    Crit          points          comment        morecomment
    Some text1.     2           Some more text1.
    Some text2.     0           Some more text2.
    Some text3.     3           Some more text3.
    Some text4.     3           Some more text4.
    Table 2
    Overall Comment
    Blah2 Blah2 Blah2!
    Some more blah2 blah2 blah2.
    Crit: Some text1.
    Proficient (points 2): Some more text1.
    Comment1...........................................
    ..Comment1.
    Crit: Some text2.
    Non-performance (points 0): Some more text2.
    Comment2...............................Comment2.
    Crit: Some text3.
    Distinguished (points 3): Some more text3.
    Crit: Some text4.
    Distinguished (points 3): Some more text4.
    Overall comments:
    Blah1 Blah1 Blah1!Some more blah1 blah1 blah1.
    Table 1
    Crit          points          comment        morecomment
    Some text1.     2           Some more text1. Comment1.............................Comment1
    Some text2.     0           Some more text2. Comment2...............................Comment2.
    Some text3.     3           Some more text3.
    Some text4.     3           Some more text4.
    Table 2
    Overall Comment
    Blah1 Blah1 Blah1!Some more blah1 blah1 blah1.--------------------------------------------------------------------
    My code which doesn't work
    WITH t AS
    (SELECT 'Crit: Some text1.
    Proficient (points 2): Some more text1.
    Crit: Some text2.
    Non-performance (points 0): Some more text2.
    Crit: Some text3.
    Distinguished (points 3): Some more text3.
    Crit: Some text4.
    Distinguished (points 3): Some more text4.
    Overall comments:
    Blah2 Blah2 Blah2!
    Some more blah2 blah2 blah2.' string
    FROM   dual)
    SELECT SUBSTR(REGEXP_SUBSTR(string,'Crit: +$', 1, level), 12) "Crit",
           SUBSTR(REGEXP_SUBSTR(string,'points [^\)]+', 1, level), 8) "points",
           SUBSTR(REGEXP_SUBSTR(string,'\):^[[:alnum:]]+$', 1, level), 3) "comment",
           SUBSTR(REGEXP_SUBSTR(string,'^[[:alnum:]]+$', 1, level), 1) "morecomment"
    FROM   t
    CONNECT BY LEVEL <= (LENGTH(string) - LENGTH(REPLACE(string, 'Crit:')))/5
    WITH t AS
    (SELECT 'Crit: Some text1.
    Proficient (points 2): Some more text1.
    Comment1...........................................
    ..Comment1
    Crit: Some text2.
    Non-performance (points 0): Some more text2.
    Crit: Some text3.
    Distinguished (points 3): Some more text3.
    Crit: Some text4.
    Distinguished (points 3): Some more text4.' string
    FROM   dual)
    SELECT SUBSTR(string, INSTR(string, 'Overall comments:', -1) + 18) "overall_comment"
    FROM   t
    CONNECT BY LEVEL <= (LENGTH(string) - LENGTH(REPLACE(string, 'Crit:')))/5Edited by: abyss on Sep 17, 2010 12:26 PM

    Hi,
    Except for the morecomment column, you almost had it.
    Oracle documentation often refers to ^ and $ as meaning beginnig- and end-of-line, but they seem to mean beginning- and end-of-string.
    Aside from that , I just changed a few details (like ' +' to '.+').
    SELECT SUBSTR (REGEXP_SUBSTR (string, 'Crit:.+',          1, level), 6, 18)     AS Crit,
           SUBSTR (REGEXP_SUBSTR (string, 'points [^\)]+',           1, level), 8    )     AS points,
           SUBSTR (REGEXP_SUBSTR (string, '\):[ [:alnum:]]+',      1, level), 3     )     AS cmnt,
           REGEXP_REPLACE ( SUBSTR ( REGEXP_SUBSTR ( string || CHR(10) ||'Crit:'
                                                         , '.*?Crit:'
                                          , 1
                                          , LEVEL + 1
                                          , 'n'          -- . matches newline
                              , LENGTH ( REGEXP_SUBSTR ( string
                                                                , 'Crit:.*'
                                               , 1
                                               , LEVEL
                                      ) +
                              LENGTH ( REGEXP_SUBSTR ( string
                                                , 1
                                                , LEVEL
                                      ) - 2
                    , 'Crit:$'
                       ) more_cmnt
    FROM   t
    CONNECT BY LEVEL <= (LENGTH(string) - LENGTH(REPLACE(string, 'Crit:')))/5
    ; This gets the results you requested from the data you posted. I don't know if it gets those results for the right reasons or not, since you didn't post any reasons for why you want those results. Always explain why you want the results you do, giving specific examples from the sample data.
    The morecomment (called more_cmnt above) is much more complicated, since it involves scanning across multiple lines. I wouldn't be surprised if there is a simpler way than what I posted above.
    I do not recommend doing this in pure SQL. I suggest a PL/SQL function, because debugging and maintenance would be so much easier.
    To populate table2:
    WITH     got_pos         AS
         SELECT     string
         ,     INSTR (string, 'Overall comments:', -1)     AS pos
         FROM     t
    SELECT  SUBSTR ( string
                , pos + 18
                )     AS overall_comment
    FROM    got_pos
    WHERE     pos     > 0
    ;

  • How to form a regular expression for matching the xml tag?

    hi i wanted to find the and match the xml tag for that i required to write the regex.
    for exmple i have a string[] str={"<data>abc</data>"};
    i want this string has to be splitted like this <data>, abc and </data>. so that i can read the splitted string value.
    the above is for a small excercise but the tagname and value can be of combination of chars/digits/spl symbols like wise.
    so please help me to write the regular expression for the above requirement

    your suggestion is most appreciable if u can give the startup like how to do this. which parser is to be used and stuff like that

  • HT5085 I would like to upload my music library from my PC to the Cloud through iTunes Match.  I also will be purchasing a Mac in the near future and would like to download some of that music from iCloud to my Mac.  Will I have compatability problems?

    I would like to upload my music library from my PC to the Cloud through iTunes Match.  I also will be purchasing a Mac in the near future and would like to download some of that music from iCloud to my Mac.  Will I have compatability problems?

    You should have no problems. To add a second computer or device to iTunes Match, see:
    http://support.apple.com/kb/ht4913
    Regards.

  • Has anyone experienced this problem: I am editing in FCP 7.0.3 on a Mac 10.6.8 - I have a clip in the browser that is full frame and matched the other clips but when I drop it in the time line it becomes a fully zoomed in version of itself

    has anyone experienced this problem: I am editing in FCP 7.0.3 on a Mac 10.6.8 - I have a clip in the browser that is full frame and fine and it matches the other clips in my bins but when I drop it into the time line it becomes a fully zoomed in version of itself and I can only see a small portion of the image.  What's going on?  I've noticed this has happened in the past randomly with other clips and it's driving me cray cray!  Any help appreciated greatly and thanks in advance for taking the time

    In the FCP Browser, click on the source clip that is showing up sized incorrectly to select it. Once it is selected, type Command + 9 to see the item properties for the clip. Either report those properties here, or take a screen shot of the item properties and post the screen shot here.
    Next, click anywhere in your sequence timeline and then type Command + 0 {zero} to see your sequence settings. Either report those settings or take a screen shot of the sequence settings and post that screen shot here.
    MtD

  • Cannot open install assistant.  I get this error message: The application cannot be installed due to a certificate problem.  The certificate does not match the installed application certificate, does not support application upgrades, or is invalid.  Pleas

    How can I downloade a trial of Adobe Elements 12? 
    I followed the instructions to download assistant...but get this message: The application cannot be installed due to a certificate problem.  The certificate does not match the installed application certificate, does not support application upgrades, or is invalid.  Please contact the application author.

    Hi alposer,
    Please remove the copy of the Adobe Download Assistant you currently have installed and then reinstall the Adobe Download Assistant.
    Regards,
    Rave

  • I have been buying apps for a long time  without a problem using my credit card on file. All of a sudden itunes is not recognizing my card which is in good standing. All the info is correct but itunes/apple says it doesn't  match the bank info. Any ideas

    I have been buying apps for a long time  without a problem using my credit card on file. All of a sudden itunes is not recognizing my card which is in good standing. All the info is correct but itunes/apple says it doesn't  match the bank info. Any ideas?

    Answered in your Other post on this Topic...
    https://discussions.apple.com/message/24053626#24053626

Maybe you are looking for