Reg expressions

Hi all

IAM learning reg exp

I have cases where iam trying to check is that the first letter of the string is of type char, which iam (able to)
IAM also able to check for the number, but unable to this looping...

I mean D45GHY iam trying to exract D and 45 but unable to understand how to adapt it in reg exp

D45GHJI of entry on-site D45
D4465GHJI of input D4465 on-site
Entry exit J7 J7GHYT
entry GHHIT J9 output J9

logic is that if the first character is the alphabet (A - Z) and second character is number;
I have to extract to a digital tank is encountered.

can you please think or pass on some readings...

Hello

Try:

SELECT REGEXP_SUBSTR('D45GHJI', '^[[:alpha:]][[:digit:]]*[^[:alpha:]]') FROM DUAL;

D45
D4465
J7
J9

Tags: Database

Similar Questions

  • Of-Rube my code please Reg Expression maybe?

    Hi all!

    I will avoid solutions based text, but after looking at my code, I thought I can get a chance to learn a better way to do it.

    Problem:

    In LV 8.6 there is a problem when an individual 'node' in a VRML file result LV to crash if I try to open a file containing this node.

    Solution:

    Wirte code to check the file and remove the cruelest bad 'node' of trying to open it.

    IF this code works, but screams "This could we better using Reg expression?"

    I think the picture tells the story.

    NOTE: The case of non-visalbe just do the wires.

    THEN, share your thoughts please.

    Ben

    Even better than my original.  This is the beginning of the selection followed until the first byeverything '} ' (and line break).

    Kudos to ben64 for the tip.

  • Question about reg expression

    Dear all,

    I'm new on reg exp. Could someone give me the reg expression for

    This string.


    000P * 00000000


    where O is digit

    * is an alpha charachers


    the string is therefore 3 numbers, hard coded P and a character alpha and 8

    for example: 123Pa45678981

    OR 223Px00000012


    the length of the shot must be 13 characters, and no more.


    Thank you

    Prash

    Hello

    DPT-Opitz wrote:

    } »

    + matches "1 alphabetic characters or more .

    To match "any 1" only, lose the +:

    } »

  • using reg expression

    I have a table called test with the names of column col1, col2.

    col1 value: 1234. col2 value: 1547

    I need o/p as 14 digits IE common present in the two columns.how to find it using reg expressions.

    Hello

    Here's another way, according to your needs:

    SELECT ename, empno, mgr

    , REGEXP_REPLACE (REGEXP_REPLACE ("0123456789")

    , '[^' || To_char (empno) | ] »

    )

    , '[^' || To_char (mgr). ] »

    ) AS common_digits

    FROM scott.emp

    ORDER BY ename

    ;

    The output does not include duplicate numbers, and the numbers will be in the order 0, 1, 2,..., 9, like this:

    ENAME, EMPNO, MGR COMMON_DIG

    ---------- ---------- ---------- ----------

    7876 7788 78 ADAMS

    7499 7698 79 ALLEN

    7698 7839 789 BLAKE

    7782 7839 78 CLARK

    7902 7566 7 FORD

    7900 7698 79 JAMES

    7566 7839 7 JONES

    KING 7839

    7654 7698 67 MARTIN

    7934 7782 7 MILLER

    7788 7566 7 SCOTT

    SMITH, 7369 7902 79

    7844 7698 78 TURNER

    DISTRICT 7-7698-7521

    You can get the same results without regular expressions, perhaps more effectively.

  • Validate through the Reg Expression

    Hello

    I have following requirement through reg expressions.
    Need to write a Boolean method that takes a string parameter which should satisfy following conditions.

    a string of length o 20 characters.
    o 9 first characters will be a number
    o next 2 characters are alphabets
    o characters 2 next will have a number. (1 to 31 or 99)
    o 1 next character will be an alphabet
    o the last 6 characters will be a number.

    JDev 11.1.1.6.0

    You can try something like this like regex:

    ^+[0-9]{9}+[a-zA-Z]{2}+(0[0-9]|1[0-9]|2[0-9]|3[0-1]|99)+[a-zA-Z]{1}+[0-9]{6}$
    

    Dario

  • CFINPUT Reg Expression Model Validation help

    I have a form with a non-mandatory field that must meet certain requirements of validation (numbers, letters, 'space' or 'white, empty string' only) if the user chooses to fill...

    I use the CFINPUT tag with the following settings, my Expression Reg model seems OK?
    REQUIRED = "No".
    VALIDATE = 'regular_expression '.
    MODEL = "^ [a-zA-Z *] {1,40}" $' "
    MAXLENGTH = "40".

    Thanks for any help. I'm v. new to regular expressions (10 hrs to Google Univ education.)

    Sincerely,
    Paul cross

    I think you want something more like this:

    ^ [a-zA-Z0-9] {0.40} $

  • How to format a value by using reg expression

    Please, I need to format a value using regular expressions.
    9911223344, 9911223344
    9911223344
      11223344
    Result
    (99) 1122-3344, (99) 1122-3344
    (99) 1122-3344
    1122-3344
    Some tips on how I can do this?

    Kind regards

    Hello

    You were close.
    The first 2 digits are optional, so add a '?' in the model.
    This means that you will get results like ' ((1122-3344'), so use REPLACE to get rid of unwanted brackets.

    SELECT  REPLACE ( REGEXP_REPLACE ( val
                                , '(\d{2})?'     -- ? added here
                               || '(\d{4})(\d{4})'
                                , '(\1) \2-\3'
                         )
              , '() '
              )       AS formatted_val
    FROM    t
    ;
    

    This assumes that "()" does not happen in the raw val. If so, use the REGEXP_REPLACE calls; a search of numbers with eactly 8 digits and the other looking for numbers with exactly 10 digits.

  • extract the string reg expression?

    How to extract P '89' 84 of this field?

    CSOM 50, HON 93, P '89' 84 JASPER YOUR L

    The string P I could start anywhere in the string, but is always followed by an apostrophe. It could be any length with a series of apostrophes and the years ending with a white or the end of the field.

    I think that regular expressions should solve this problem, but I can't understand it. Any help is appreciated.

    Hello

    Here's one way:

    REGEXP_SUBSTR ( txt
               , 'P'          || -- The letter P
              '('          || -- Begin \1
                  ''''     ||     -- apostophe
                  '[0-9]+'     ||     -- 1 or more digits (see below for alternative)
              ')+'          || -- End \1, which may occur 1 or more times
              '( |$)'             -- Either space or end-of-string
               )
    

    If the years must be exactly two digits, then change the line 5 to:

    ...              '[0-9]{2}'     ||     -- exactly 2 digits
    
  • Expression of reg VCS

    Hello.. I need assistance with reg expression for my calls (conf)

    1866123123 * xxxxxxxx to be replaced by sip:[email protected] / * /

    Much appreciated your help...

    Tried, but do not replace ^(1866123123**) (\d {8}) with sip:------[email protected] / * / (not working)

    Paulo Souza

    Please note the answers and mark it as "answered" as appropriate.

  • REG EXP to find if a field starts with a letter

    Hello

    I have a code to clean some phone numbers, and now I want to add a condition to leave the field only if it begins with a letter.

    -------------------------------------------------

    Select

    SR_SERVICE_ID,

    case
    When SR_SERVICE_ID like "% @% ' -does not INCLUDE YEAR ' @' SYMBOL
    then
    SR_SERVICE_ID,
    case
    When SR_SERVICE_ID ' ^ [a-zA-Z] "-STARTS WITH a LETTER (NOT the BODY)"
    then
    SR_SERVICE_ID

    on the other

    '0' || regexp_replace ({SR_SERVICE_ID, ' \D|^0{1} "")-ADD A '0' FOR THE START OF THE FIELD AND GARNISH

    end CLEANSED

    Of
    TABLE_1;

    --------------------------------------------

    The "SR_SERVICE_ID" field contains email addresses, phone numbers and MOBILE numbers in the format '0400123456'

    I want the script to check if the value of the field begins with a letter or contains a ' @' & ignore them and then go to add a '0' in the field at the start.

    Everything works except the below;

    ------------------

    case

    When SR_SERVICE_ID ' ^ [a-zA-Z] "-STARTS WITH a LETTER (NOT the BODY)"

    then

    SR_SERVICE_ID

    ------------------

    The problem is that it does not accept the part of the instruction box on the field starting with a letter?

    Can anyone comment why it won't explain all the parts of the Reg Expression they add so I can learn more?

    Thank you

    Hello

    woof777 wrote:

    Thanks again,

    Can you explain what you mean by "then you must only change this WHEN this CASE expression clause.

    I tried everything I can think of, use the instructions box separately & everything is OK, once I add the second back, "Missing Keyword" error.

    I don't see what went wrong the syntax below is just an example, it is not supposed to be correct, just display synatx method.

    ------------

    "case when (expression) then foo .

    -case when (expression) then Do_Something_More

    Else (expression)

    END New_Field_Name ".

    --------------

    Miss me a rule simple syntax here, everything suggests?

    It seemed all you had to do was change a WHEN clause, but unless you post some examples of data in a form usable (for example, CREATE TABLE and INSERT statements) I can't say for sure.

    CASE expressions don't 'do something', or 'do something' in a CASE expression.   What comes after each key word IS a noun, not a verb.  Like all expressions, a CASE expression is something that generates a unique value in a SQL data types; in this case, a VARCHAR2.  After each THEN or ELSE keyword, there must be an expression of the same type.

    After the key words WHEN you have conditions (i.e. operations that result in TRUE, FALSE, or UNKNOWN), not expressions.

    Thus a better model of a CASE expression

    CASE
        WHEN  condition_1  THEN  expression_1
        WHEN  condition_1  THEN  expression_2
                                          ELSE expression_3
    END
    

    If (but only if) the CASE expression is the last part of a column in a SELECT clause, then it can be followed by an alias, such as New_Field_Name.  The alias is the part of the syntax of the SELECT clause; It's completely outside of and independent of the syntax of the CASE expression.

  • Expressions and model matchers

    I want to parse a string using reg expressions, but I want to clarify a string from end of string - all characters - start. I want him to stop the first time he finds the end string not the last time that he finds it.

    Here is my code
    Public Shared Sub main (String [] args) {}
    String text = "" an it's first group b an it's second group b b xxxxxxx ";"
    String oldHeader2 = "a.*b"; I want the search to stop after the first b
    Pattern pattern = Pattern.compile (oldHeader2);
    Matcher Matcher = pattern.matcher (text);
    While (matcher.find ()) {}
    System.out.println("---");
    Get the corresponding string
    Matching strings = matcher.group ();
    System.out.println (match);
    }

    My output is as follows
    ----
    a this is the first group b an it's second group b b xxxxxxx

    I need to go out like that
    ----
    a this is the first group b
    ----
    a this is the second group b

    cjgoode wrote:
    I want to parse a string using reg expressions, but I want to clarify a string from end of string - all characters - start. I want him to stop the first time he finds the end string not the last time that he finds it.

    public static void main(String[] args) {
    String text = " a this is the first group b a this is the second group b xxxxxxx b";
    String oldHeader2 = "a.*b";  // I want the search to stop after the first b
    Pattern pattern = Pattern.compile(oldHeader2 );
    Matcher matcher = pattern.matcher(text);
    while (matcher.find()) {
    System.out.println("----");
    // Get the matching string
    String match = matcher.group();
    System.out.println(match);
    }
    }
    

    You use a greedy quantifier, but you want a reluctant quantifier.
    http://download.Oracle.com/javase/6/docs/API/Java/util/regex/pattern.html#sum

  • Regular expression to allow only numeric characters or spaces in the num field such

    Hi people

    Am Newbie Apex using 4.0.1 / Vista / Oracle XE and am trying to create a level validation element on a phone number field

    I want any combination of numbers and valid spaces with only the obvious condition that the field cannot be completely spaces.

    Can anyone help to suggest how to do because I'm really bad with something so simple that I have no exp prev reg expressions.

    Thank you, as always
    Peter

    Hello
    It's quite strange, I just tried your entry (without apostrophes) and it passed. Do you have you copied my reg exp (a ^ $ included) and pasted into the Expression of Validation 2 field validation with regular Expression of type? We must really work.

    Jirka

  • using reg exp

    Hello

    I need to extract the first file name token (and not the directory path) of a string like this:

    D:\MIRACLE\UPLOADS\1361\HG-ORA02#xaldb#alertlog_contents#22022010111941.mirdf.loadfailed_240210095258_62
    HG-ouA02 #xaldb #alertlog_contents #22022010111941.mirdf.loadfailed_240210095258_62
    \HG-ORA02#xaldb#alertlog_contents#22022010111941.mirdf.loadfailed_240210095258_62
    /Hg-ORA02#xaldb#alertlog_contents#22022010111941.mirdf.loadfailed_240210095258_62

    the chips would be bed HG-ouA02 in all cases

    Could you help me create a reg expression to get the token?

    Best regards
    Mette

    Hello

    Whenever you have a problem, it helps if you post your sample data in a form, people can use.
    CREATE TABLE and INSERT statements are great. therefore:

    CREATE TABLE     table_x
    AS          select 'D:\MIRACLE\UPLOADS\1361\HG-ORA02#xaldb#alertlog_contents#22022010111941.mirdf.loadfailed_240210095258_62'
                   AS filename, 1 as x_id FROM dual
    UNION ALL     SELECT 'HG-ORA02#xaldb#alertlog_contents#22022010111941.mirdf.loadfailed_240210095258_62'
                   AS filename, 2 as x_id FROM dual
    UNION ALL     SELECT '\HG-ORA02#xaldb#alertlog_contents#22022010111941.mirdf.loadfailed_240210095258_62'
                   AS filename, 3 as x_id FROM dual
    UNION ALL     SELECT '/HG-ORA02#xaldb#alertlog_contents#22022010111941.mirdf.loadfailed_240210095258_62'
                   AS filename, 4 as x_id FROM dual
    ;
    

    It also helps if you explain how you get the results you want from these data.

    Assuming that
    (a) the name of file is divided, firstly, by ' / ' or ' \' characters, and
    (b) each of these parts can be subdivided into tokens by '.' or the characters ' # ' and that
    (c) we want the first part (b) of the last (part a):

    SELECT     REGEXP_SUBSTR ( REGEXP_SUBSTR ( filename
                              , '[^/\]*$'
                              )
                    , '[^.#]+'
                    ) AS token_1
    FROM     table_x;
    

    Here the inner circle REGEXP_SUBSTR finds the last part delimited by / or \. You can add other delimiters by placing them in square parentheses, anywhere after ^.
    The external REGEXP_SUBSTR works on the results of the Interior. He returned the first part bounded by. or #. Again, you can add other delimiters.

  • regular expression: letters and numbers allowed

    How can I determine the best next way: input string can only contain numbers and letters, the letters can be of any alphabet.
    Examples:
    "123aBc" - correct, only numbers and letters
    "' aBc 123 '-bad, contains spaces
    "' aBc 123 '-bad, contains commas
    "oauo" - correct, contains letters of the Estonian alphabet.
    "abc" - correct, contains letters of the English alphabet.

    I think that I should use the function "regexp_like' for this, because-LIKE operator cannot do such things, correct?

    How should I write the regular expression then? I'm new on reg expressions.

    Hello

    I don't think that you need one or. A simple replacement would do.

    with Test as
        (select '123aBc' Str from dual union
         select '123,aBc' from dual union
         select 'aäüõ' from dual
         )
        --
        select str
        from test
       where regexp_like(replace(str,'.',''), '^[[:alnum:]]*$')
    

    Arun-

  • formatted string

    I have different strings in my project, for example:

    12.4432615352312

    I want that all these channels have 2 decimal places, so 12.44; How can I do this? I was looking for 'Format value function' and also 'format as string' (format string), but without success.

    Thank you

    Here's a very easy way

    Although there is probably a method using reg expressions without the intermidiatry changing double.

    Craig

Maybe you are looking for

  • accidentally disabled enhanced usb controller now can not log on to windows

    I accidentally disabled thr enhanced usb host controller.now no usb ports don't work so I can't open the computor to reactivate the controller

  • How to show a PIN with a custom on mapview icon?

    I use the following code to add a PIN, the card appears but the PIN does not appear. Tested on a real 10.1 Z10. GeoLocation *pin = new GeoLocation(lat, lon, mapview); pin->setName("somename"); pin->setDescription("some description"); Marker marker; m

  • Lock the HID mouse

    I used the world of Warcraft Cataclysm Gaming Mouse SteelSeries for a few years. Until very recently, it worked perfectly. A few months ago the mouse randomly (once every 5 minutes once every hour couple) began to lock up for a few seconds, up to 10,

  • Phones vibrate smart blackBerry and the tone does not at the same time not in the 8703e Verizon model

    When I try to set a notification on the setting profile "Vibrate + tone" to incoming calls, it just vibrates and does not sound.  When I put it just 'tone' it sounds.  All settings are disabled mute.  Any suggestions?

  • Smartphones blackBerry browser problem

    Hey, I got my BB about 2 weeks so I'm still getting used to it.  I have a BB Curve 8330.  All of a sudden this morning I noticed my missing browser icon.  I have searched for it with the application of research and it has not been discovered.  Then I