Query regarding Regular expressions

Help me in regular expression for “one or two digits must followed by : and one or two digits”

user8701050 wrote:
thanqI assume you meant "thank you." Please use real words.
In any case, you're welcome. So now that you know, your best course of action would be to study that tutorial, and/or this one: http://www.regular-expressions.info/tutorial.html, take your best shot, then post again if you get stuck, showing what you tried and explaining clearly the problems you encountered.
Good luck!

Similar Messages

  • Help in query using regular expression

    HI,
    I need a help to get the below output using regular expression query. Please help me.
    SELECT REGEXP_SUBSTR ('PWRPKG(P/W+P/L+CC)', '[^+]+', 1, lvl) val, lvl
    FROM DUAL,(SELECT LEVEL lvl FROM DUAL
    CONNECT BY LEVEL <=(SELECT MAX ( LENGTH ('PWRPKG(P/W+P/L+CC)') - LENGTH (REPLACE ('PWRPKG(P/W+P/L+CC)','+',NULL))+ 1) FROM DUAL));
    I need the output as
    correct result:
    ==============
    val lvl
    P/W 1
    P/L 2
    CC 3
    But i tried the above it is not coming the above result. Please help me where i did a mistake.
    Thanks in advance

    Frank gave you a solution in your other thread. You could simplify it if you are on 11g:
    SQL> select * from table_x
      2  /
    TXT
    TECHPKG(INTELLI CC+FRT SONAR)
    PWRPKG(P/W+P/L+CC)
    select  txt,
            regexp_substr(
                          txt,
                          '(.*\()*([^+)]+)',
                          1,
                          column_value,
                          null,
                          2
                         ) element,
            column_value element_number
      from  table_x,
            table(
                  cast(
                       multiset(
                                select  level
                                  from  dual
                                  connect by level <= regexp_count(txt,'\+') + 1
                       as sys.OdciNumberList
      order by rowid,
               column_value
    TXT                                      ELEMENT    ELEMENT_NUMBER
    TECHPKG(INTELLI CC+FRT SONAR)            INTELLI CC              1
    TECHPKG(INTELLI CC+FRT SONAR)            FRT SONAR               2
    PWRPKG(P/W+P/L+CC)                       P/W                     1
    PWRPKG(P/W+P/L+CC)                       P/L                     2
    PWRPKG(P/W+P/L+CC)                       CC                      3
    SQL>  SY.

  • Help regarding regular expression

    HI All ,
    Please see the following string
    String s = "IF ((NOT NUM4 IS ALPHABETIC ) AND NUM3 IS ALPHABETIC-UPPER AND (NUM5 IS GREATER OR EQUAL TO 3) AND (NUM5 IS NOT GREATER THAN 3) AND (NUM3 GREATER THAN 46) AND (NUM5 GREATER THAN NUM3) OR NUM3 LESS THAN 78) .";
    My problem is: i want to capture the part of this line which contains "ALPHABETIC ,ALPHABETIC-UPPER for ex :NOT NUM4 IS ALPHABETIC , NUM3 IS ALPHABETIC-UPPER.from that I have to capture the word num4 , num3 which are in these phrases only ;from the whole string whereever it exists along with the phrase,Can any one help me out by suggesting something.num4 and num3 are variable names

    I suspect you're right, Sabre, but I can't resist...
    import java.util.regex.*;
    * A rewriter does a global substitution in the strings passed to its
    * 'rewrite' method. It uses the pattern supplied to its constructor, and is
    * like 'String.replaceAll' except for the fact that its replacement strings
    * are generated by invoking a method you write, rather than from another
    * string. This class is supposed to be equivalent to Ruby's 'gsub' when given
    * a block. This is the nicest syntax I've managed to come up with in Java so
    * far. It's not too bad, and might actually be preferable if you want to do
    * the same rewriting to a number of strings in the same method or class. See
    * the example 'main' for a sample of how to use this class.
    * @author Elliott Hughes
    public abstract class Rewriter
      private Pattern pattern;
      private Matcher matcher;
       * Constructs a rewriter using the given regular expression; the syntax is
       * the same as for 'Pattern.compile'.
      public Rewriter(String regularExpression)
        this.pattern = Pattern.compile(regularExpression);
       * Returns the input subsequence captured by the given group during the
       * previous match operation.
      public String group(int i)
        return matcher.group(i);
       * Overridden to compute a replacement for each match. Use the method
       * 'group' to access the captured groups.
      public abstract String replacement();
       * Returns the result of rewriting 'original' by invoking the method
       * 'replacement' for each match of the regular expression supplied to the
       * constructor.
      public String rewrite(CharSequence original)
        this.matcher = pattern.matcher(original);
        StringBuffer result = new StringBuffer(original.length());
        while (matcher.find())
          matcher.appendReplacement(result, "");
          result.append(replacement());
        matcher.appendTail(result);
        return result.toString();
      public static void main(String[] args)
        String s = "IF ((NOT NUM4 IS ALPHABETIC ) " +
                    "AND NUM3 IS ALPHABETIC-UPPER " +
                    "AND (NUM5 IS GREATER  OR EQUAL TO 3) " +
                    "AND (NUM5 IS NOT GREATER THAN 3) " +
                    "AND (NUM3 GREATER THAN 46) " +
                    "AND NUM645 IS ALPHABETIC " +
                    "AND (NUM5 GREATER THAN NUM3) " +
                    "OR NUM3 LESS THAN 78 " +
                    "AND NUM34 IS ALPHABETIC-UPPER " +
                    "AND NUM92 IS ALPHABETIC-LOWER " +
                    "AND NUM0987 IS ALPHABETIC-LOWER) .";
        String result =
          new Rewriter("(NUM\\d+) +IS +(ALPHABETIC(?:-(?:UPPER|LOWER))?)")
            public String replacement()
              String type = group(2);
              if (type.endsWith("UPPER"))
                return "Character.isUpper(" + group(1) + ")";
              else if (type.endsWith("LOWER"))
                return "Character.isLower(" + group(1) + ")";
              else
                return "Character.isLetter(" + group(1) + ")";
          }.rewrite(s);
        System.out.println(result);
    }

  • Help needed regarding regular expressions

    hello
    i need to write a program that recieves a matematical expression and evaluates
    it...in other words a calculator :)
    i know i need to use regular expressions inorder to determine if the input is legal or not ,but i'm really having trouble setting the pattern
    the expression can be in the form : Axxze2223+log(5)+(2*3)*(5+4)
    where Axxze2223 is a variable(i.e a combination of letters and numbers.)
    where as: l o g (5) or log() or Axxx33aaaa or () are illegal
    i tried to set the pattern but i got exceptions or it just didnt work the way i wanted it .
    here's what i tried to do at least for the varibale form:
    "\\s*(*([a-zA-Z]+\\d)+)*\\s*";
    i'm really new to this...and i can't seem to set the pattern by using regular expressions,how can i combine all the rules to one string?
    any help or references would be appreciated
    thanks

    so i'll explain
    let's say i got token "abc22c"(let's call it "token")
    i wan't to check if it's legal
    i define:
    String varPattern = "\\s*[a-zA-Z]+\\d+\\s*";If you want to check a sequence of ASCII characters, longer than one, followed by a single digit, the whole possibly surrounded by spaces -- yes.
    >
    now i want to check if it's o.k
    so i check:
    token.matches(varPattern);
    am i correct?Quite. It's better to compile the Pattern (Pattern.compile(String)), create a java.util.regex.Matcher (Pattern#matcher(CharSequence)), and test the Matcher for Matcher#matches().
    (Class.method -> static method, Class#method -> instance method)
    >
    now i'm having problem defining pattern for log()
    sin() cos()
    that brackets are mandatory ,and there must be an
    expression inside
    how do i do that?First, I'd check the overall function syntax (a valid name, brackets), then whether what's inside the brackets is a valid expression (maybe empty), then whether that expression is valid for that function (presumably always?).
    I might add I'm no expert on parsing, so that's more a supposition than a guide.

  • Query regarding cron expression in BPEL

    Hi,
    I am using the quartz scheduler in BPEL and using the cron expression in bpel.xml
    but the problem I am facing is it is running for only one day it is not running for the next day
    the expression I am writting in bpel.xml is
    <activationAgents>
    <activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="FileScBpel4" heartBeatInterval="10">
    <property name="schedulerCallout">DefaultSchedulerCalloutImpl</property>
    <property name="endpointScheduleOn">0 30 19 * * ?</property>
    <property name="endpointScheduleOff">0 31 19 * * ?</property>
    </activationAgent>
    </activationAgents>
    so if I deploy it in BPEL PM it will run for today at 19:30
    but when I am changing the system date to the next day and changing the time to 19:30 it is not running again
    can anybody plz help me out how can I schedule it for everyday 19:30

    Hi Sailo,
    If you use quartz as a servlet, you'll have to add the entry to you're web.xml, in addition to other servlets you create :
    <servlet>
    <servlet-name>QuartzInitializer</servlet-name>
    <servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <init-param>
    <param-name>config-file</param-name>
    <param-value>quartz.properties</param-value>
    </init-param>
    <init-param>
    <param-name>shutdown-on-unload</param-name>
    <param-value>true</param-value>
    </init-param>
    <init-param>
    <param-name>start-scheduler-on-load</param-name>
    <param-value>true</param-value>
    </init-param>
    </servlet>
    Cheers
    Pucha Anirudh

  • Query regarding regx

    Hi,
    I have a query regarding regular expression.
    what regular expression should I use which matches the following urls
    http://www.abc.com/xyz
    http://www.abc.com/xyz/abc.htm
    http://www.abc.com/xyz/<any thing>
    but it should not match
    http://www.abc.com/xyz45d
    http://www.abc.com/xyz<anything> if(anything does not start with /)
    I wrote the regx as : (http://www.abc.com/xyz)(/\w)*
    but it also matches the last url.
    Thanks
    Edited by: JL.Nayak on Jun 26, 2008 9:36 AM

    prometheuzz wrote:
    kajbj wrote:
    No, that's also incorrect.I have always found it a bit odd that people continue to answer questions that already have been answered, and especially if they post an incorrect answer.Usually this can be explained by the fact that there are still some Dukes to be rewarded to the thread in question. That's not the case with this one: odd indeed.But does that mean that you shouldn't read the other replies before you post your reply?
    (There must be a rule that says that you aren't allowed to read the other replies if you are posting in a certification thread, another odd thing)

  • Query help in regular expression

    Hi all,
    SELECT * FROM emp11
    WHERE INSTR(ENAME,'A',1,2) >0;
    Please let me know the equivalent query using regular expressions.
    i have tried this after going through oracle regular expressions documentation.
    SELECT * FROM emp11
    WHERE regexp_LIKE(ename,'A{2}')
    Any help in this regard would be highly appreciated .
       Thanks,
    P Prakash

    please go here
    Introduction to regular expressions ...
    Thanks,
    P Prakash

  • Regular expressions: find files with exactly 'n' digits in a row

    Hi there,
    I want to filter files that contain only a fixed number of digits, but not more (at least not in after the digits).
    For example, I have
    01.mp3
    02.mp3
    test10.txt
    test000110101010.txt
    04.flac
    and for n=2 I want to get all files except 'test000110101010.txt'.
    The following is not working, and I'm a total newb regarding regular expressions
    ls -l | grep '^-' | awk '{print $9}' | grep '([0-9]\{2\})[^0-9]\{2\}'
    Thanks for help.
    Regards,
    drm

    Thanks!
    I wrote a python script to scan e.g. a music folder for missing files and needed to extract the file numbers from the files to get the "highest" number.
    You can get it from here: http://pastebin.com/Sg9yDHiw (Python3, expires in 1 month)
    Regards,
    drm
    Edit: found a bug
    Last edited by drm00 (2011-02-04 13:57:43)

  • Faulty Regular Expression

    Hi all,
    I have a question regarding regular expressions.. I am refactoring a method named isPasswordValid() and removing a bunch of ugly Java code that enforces the following rules:
    Does it begin with an upper or lowercase letter?
    Does it contain at least one lowercase letter?
    Does it contain at leasr one uppercase letter?
    Does it contain at least one number?
    Does it contain at least one special character from the following: !@#$%^&*-_+=
    Is it at least 15 characters?I have extracted my regular expression into a dummy class for easier testing:
    public class RegExTest {
         public static void main(String[] args) {
              String password ="qwerty34#$QWERTY";
              if (password.matches("^[a-zA-Z]{1}.{14,}")
                        && password.matches(".*[a-z]+.*")
                        && password.matches(".*[A-Z]+.*")
                        && password.matches(".*[0-9]+.*")
                           && password.matches(".*[!@#$%^&*-_+=]+.*")) {
                   System.out.println("This is a match");
    }This regular expression works as intended except for an issue with special characters. It accepts every special character specified as well as others like the tilda (~) and parenthesis. I even tried escaping the ones that needed escaping but nothing seems to work. What am I missing here? Also, do you see anything else I should be concerned with? Of course, any help would be greatly appreciated!
    Thanks!

    When not placed at the start or end of a character class, the hyphen is a range operator:
    [a-d]    // matches 'a', 'b', 'c' or 'd'
    [ad-]    // matches 'a', 'd' or '-'
    [-ad]    // matches '-', 'a' or 'd'Or escape it:
    [a\-d]    // matches 'a', '-' or 'd'

  • Regular Expression Abbreviation of Words

    Suppose I have got data in my column like
    Balla Ram Chog Mal College
    Maharishi Dayanand University
    Cambridge Public School
    Now I want to write a query using regular expressions to find out the abbreviations. e.g the resulting data set should be:
    BRCMC
    MDU
    CPS
    How should I write regexp for it ?

    One way, using SUBSTR and INSTR, tested on 10g.
    with data as
      select 'Balla Ram Chog Mal College' col from dual union all
      select 'Maharishi Dayanand University' col from dual union all
      select 'Cambridge Public School' col from dual
    select col, replace(ltrim(max(sys_connect_by_path(str, ',')) keep (dense_rank last order by r), ','), ',') abbr
      from (
    select col, substr(col, decode(level, 1, 1, instr(col, ' ', 1, level - 1) + 1), 1) str, level, row_number() over (partition by col order by level) r
      from data
    connect by level <= length(col) - length(replace(col, ' ')) + 1
           and col = prior col
           and prior sys_guid() is not null
    order by col, level
    group by col
    start with r = 1
    connect by r - 1 = prior r
           and col = prior col
           and prior sys_guid() is not null;
    COL                           ABBR
    Balla Ram Chog Mal College    BRCMC
    Cambridge Public School       CPS 
    Maharishi Dayanand University MDU
    With 11g, you will not require the Outer query to concatenate the results, you can directly use LISTAGG as demonstrated by Hashim.

  • Regular Expressions Query!! -- Help

    Hi,
    I'm writing a SQL query using Regualar Expressions in Oracle 10g.
    select entry_id,entry_value, from entry_logbook where REGEXP_LIKE(entry_value,'^[a-z]|[0-9]|[A-Z]')
    I expect the result contains only records with values starting with alphabets or integers.
    But I'm getting values like '** Something **', '#123445' etc.
    Please let me know what I'm missing here.
    Regards,
    Venkat

    SQL> with sample as
      2  (select '##@Sarma123%$%$' col from dual
      3  union all
      4  select 'sarma' from dual
      5  union all
      6  select '123SARMA' from dual
      7  union all
      8  select 'RADHA' from dual
      9  )
    10  select col
    11  from sample
    12  where regexp_like (col, '^[a-z0-9A-Z]')
    13  /
    COL
    sarma
    123SARMA
    RADHA
    SQL>Cheers
    Sarma.

  • Regular expression to convert sqlite query to 'normal' query.

    How would go about using this regular expression
    strftime\([^'"]['"]([^"']+)['"], [^ ]+[^\)]\)to return a value like
    DATE_FORMAT( backreference1, backreference2 )Basically I need to do something like:             ResultSet waarnemingen = stat.executeQuery(  "SELECT strftime( '%Y%m%d', datum ) as dtm, minTemp, maxTemp, etmaalneerslag FROM waarnemingen " +
                           "WHERE stationsnummer = '"+stationsnummer+"' "+
                           "AND strftime( '%Y%m', datum ) = '"+jaar+maand+"'" );       
    //             ResultSet waarnemingen = stat.executeQuery(  "SELECT DATE_FORMAT( datum, '%Y%m%d' ) as dtm, minTemp, maxTemp, etmaalneerslag FROM waarnemingen " +
    //                       "WHERE stationsnummer = '"+stationsnummer+"' "+
    //                       "AND DATE_FORMAT( datum, '%Y%m' ) = '"+jaar+maand+"'" ); Where the commented part is what it's supposed to become.
    Edited by: Axeia on May 22, 2009 8:50 AM

    public static void main(String[] args)
            final String theQuery = "ResultSet waarnemingen = stat.executeQuery(  \"SELECT strftime( '%Y%m%d', datum ) as dtm, minTemp, maxTemp, etmaalneerslag FROM waarnemingen \" +"
                                    + "\"WHERE stationsnummer = '\"+stationsnummer+\"' \"+"
                                    + "\"AND strftime( '%Y%m', datum ) = '\"+jaar+maand+\"'\" );";
            final Pattern thePattern = Pattern.compile("(strftime\\(([^,]+),([^\\)]+)\\))");
            System.out.println(thePattern.matcher(theQuery).replaceAll("DATE_FORMAT($3,$2)"));
        }Would it be something like that that you are looking for?
    Regards.

  • Regarding Line Break Expression (New to Regular Expression)

    Hi,
    I am new to regular expression.
    I have a query.Suppose I have a
    String str = Anshuk
    Anshuk1
    Anshuk2
    Anshuk3
    Anshuk4
    where we have a line break after Anshuk and then again after Anshuk1 and so on.Actually, we have different records in different lines.
    how do I make it possible usign regex that to make him inderastand that those are in different lines (meaning different records)?
    I m trying...but not getting it..wat should be the code?
    anshuk

    What do you mean? What have you done?
    Have you set the pattern to use MULTILINE?
    Kaj

  • Urgent help regarding Java regular expressions.

    hello everyone,
    I am trying to parse a html file which contains
    dyn.Img("http://www.boston.com/news/nation/articles/2007/06/21/bill_clinton_takes_bigger_campaign_role&h=306&w=410&sz=13&hl=en&start=43","","QFo9lqKeMR7uzM:","http://cache.boston.com/resize/bonzai-fba/AP_Photo/2007/06/21/1182410228_1931/410w.jpg","125","93","\x3cb\x3eBill Clinton\x3c/b\x3e takes bigger campaign \x3cb\x3e...\x3c/b\x3e","","","410 x 306 - 13k","jpg","www.boston.com","","","http://tbn0.google.com/images","1")
    the given above function many times. I have to fetch the whole functions into an array. So i have to write a regular expression which recognises the whole above string.
    Can anyone please help me.
    Thank you,
    chaitanya

    well if this is all you want
    http://cache.boston.com/resize/bonzai-fba/AP_Photo/2007/06/21/1182410228_1931/410w.jpg
    You can always substring it like chuck said
    ***BUT all the images would have to be .jpg for this to work***
    back = we.indexOf(".jpg");
    int x = 0;
    while (back < web.lastIndexOf(".jpg"))
                    back = web.indexOf("http",back+1);
                    picture[x] = web.substring(front, back);
                    x++;
                    front = back;
                  }       Might not be the best code but it worked with a website i had to parse
    Message was edited by:
    mark07

  • Regarding The regular expression

    Hi  all:
       there is an error in the following statement , the error messge while activating the system  says
    The regular expression '|' is invalid character at position 1., could u pls tell me how exactly correct the following statements. 
    REPLACE ALL OCCURRENCES of REGEX '|' in s_name1 with ''.
    REPLACE ALL OCCURRENCES of REGEX '?' in s_name1 with ''.
    REPLACE ALL OCCURRENCES of REGEX '*' in s_name1 with ''.
    Thank u vrey much for any reply

    hi ,
    I agree with thomas , u dont have to specify REGEX ...
    For Ex :
    data : g_str2(100)  type  c  value '12:30:40'.
    REPLACE ALL OCCURRENCES OF ':' IN G_STR2 WITH SPACE.
    Result : g_str2 = 12 30 40.
    All occurances of g_str2 will be replaced by space.
    Cheers !
    Soumya Ranjan

Maybe you are looking for

  • Photoshop File Formats incomplete

    In short, the Photoshop File Formats documentation @ http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/ left out at least one key piece of information: It is not noted anywhere that the global Additional Layer Information entries (after Glo

  • Menu just stopped working

    Yesterday my main menu just stopped working. You can see the top of the drop shadow for the flyouts but for the life of me I can't make the flyouts show again. I tried pushing multiple back up copies of the site that I had and nothing help. Anybody h

  • Need an AUTOCLICKER for my mac book pro - help -- anyone?

    Used to ahve any autoclicker on my PC, now with a MAc, I can't find one which is Mac friendly? Thanks! Mark

  • How to find this Search object relavant to which root object?

    Hi All,   how to find this Search object relavant to which root object?   As I am having search object 'BTQuery1O', so which is root object for this?   how to find this?

  • Edit crop does not save, edit crop does not save

    When editing a photograph, the crop function does not save.  This is the office Mac desktop, 10.5.08, Iphoto 6.06.  Any help appreciated.