RegExp as

My requirement is
I want the values except the uppercase letters
as I don't want

AAA
1A

This is the test script

create table test4 (test4 varchar2 (30))

insert into values('AAA') of test4
insert into values('aaa') of test4
insert into values('Aaa') of test4
insert into values('aAa') of test4
insert into values('111') of test4
insert into values('1a') of test4
insert into values('1A') of test4


Select * from test4
where REGEXP_LIKE (test4,'^ [A-Za-z]')
and not REGEXP_LIKE (test4, ' ^ [-[: upper:]] + $')
and not REGEXP_LIKE (test4, ' ^ [: 0-9]')

I get everything except


1A

Please help me to down the query
and also the regxp can can merged in
a single statement

Thank you

Try this [not tested]

Select * from test4 where regexp_like(test4,'[[:lower:]]');

Tags: Database

Similar Questions

  • standard character of regexp

    Hello

    I'm looking for a regexp avoid the user using anything else than 1-9 a - z A - Z and '_' to a file name.

    concerning

    Tinnitus

    [^ \w] matches anything that is not an alphabetic character.

  • Limiting the tables and using lindex in commands regexp

    Hello

    Here's my second and extremely crap question/post in what concerns the EEM/TCL.  I did some research on Google and have not really been able to find an answer to these questions.  Probably more due to my lack of agility with the search bar of the information being just is not there.  Hope you'll forgive me if.

    1. my first question is this.  Say I want to get an output of a command.  I would like to see all the interfaces in the 'ip vrf command show interface' for example.  Not knowing how many interfaces there may be, there could be 10, or there might be 200, what is the best way to limit a loop function after that I gave the following commands?

    Set _vrf_int [exec show ip vrf interface]
    Set _array_vrf_int [split $_vrf_int '\n']

    set $i 0

    then {$i< 200}="">
    RegExp {([A-Z]+[a-z]+[0-9]+). *} [lindex $_array_vrf_int $i] _complete_string _int
    Inc. $i 1

    }

    Not 100% sure that the syntax is correct, sorry.  If I don't have that 10 interfaces so it won't be necessary to issue this loop 200 times to "$_array_vrf_int".  Also wouldn't be great if I went through the 200 interfaces.  Is there a way I can limit this loop based on the number of lines that were captured after the split function?

    2. the value of the regular expression above is output in the var $_int.  Is there a way I can output the regular expression in a table? a ' :-

    RegExp {([A-Z]+[a-z]+[0-9]+). *} [lindex $_array_vrf_int $i] _complete_string [lindex $ $i _int]

    Syntax is certainly not correct, but I guess there could be a way to do this.  Any thoughts?

    3. I did some comparisons on an outing to see if an access list is present on an interface.  I can get a regexp to pull back the name of the access on a given interface list, but if there are any access-list to an if statement on anything?

    Set _acl_name 0

    RegExp {. * ip access-group (. *) in} $_running_int _complete_string _acl_name

    If {$_acl_name! = 0} {puts ' there is an access-list on $_int "} else {puts ' there is no acl on _int $ :-("} "}

    In the above output I'm defining the value of ' $_acl_name ' to zero so that I can compare it to the fi statement.  This seems to be a newbie to shit how do however.  Is it a kind of generic I put in place of the '0' to match an empty variable. has ' {null}.

    4 I'm sorry last question.  I also reset the variable {null} using a similar wildcard.  Once again I can reset the variable to 0, but it seems just that I do not understand that the syntax well enough and it is without doubt a better method.

    5. I have read several tutorials that cover a lot of bases.  Is there a good reference that anyone can suggest so I don't waste your time with these silly questions?  I'm afraid that the scripts I've studied on this forum are always way above my head.

    Thanks in advance

    Alex

    Assume that the limit of the loop.  Which will never end well.  Instead, use a foreach loop to iterate over the number of lines in the output:

    set vrf_int [exec "show ip vrf interface"]

    foreach line [split $vrf_int "\n"] {
      if { [regexp {([A-Za-z0-9]+).*} $line -> int_name] } {

    puts "Interface name is $int_name"

    }

    }

    In addition, do not use the variables that start with "_".  Those that are reserved for the Cisco or overall use.  In addition, 'exec' is a single command tclsh.  If you use the EEM Tcl, you will need to interact with the CLI library.  You can watch our best practices guide at https://supportforums.cisco.com/docs/DOC-12757 for some tips and tricks with the use of EEM.

    You can use - all and--inline for regexp all return in a list.  However, given the idea of the loop above, you can also use lappend to each pass:

    set intlst [regexp -all -inline {([A-Za-z0-9]+).*} $output]

    set vrf_int [exec "show ip vrf interface"]

    set intlst [list]

    foreach line [split $vrf_int "\n"] {
      if { [regexp {([A-Za-z0-9]+).*} $line -> int_name] } {

    lappend intlst $int_name

    }

    }


    You can use "info exist" or simply to check the result of your regexp command to see if a match took place.  See the example above the latter.

    regexp {.*ip access-group (.*) in} $_running_int _complete_string _acl_name

    if {[info exists $_acl_name]} {puts "there is a access-list on $_int"} else {puts "there's no acl on $_int :-("}

    You can 'reset' a variable by using the command 'deactivated '.

    One of the best general Tcl references is the "book of the pen:

    http://www.Amazon.com/practical-programming-Tcl-4th-Edition/DP/0130385603/ref=sr_1_2?ie=UTF8&QID=1333817448&SR=8-2

  • RegExp

    Hi all

    To exclude it using the regexp, if I want to "has" the value of the name column 'a' need to remove data from remaning.

    Insert into TEST (NAME) Values ('a, b, c');

    Required: if I spend 'a'-> 'b, c' should be deleted-> output-> in the name column

    Required: if I switch "b"-> 'a, c' should be deleted-> output-> b in the name column

    Thank you

    Expect update the value you pass? Under update check if the value passed exists or not... If there is, it will update this line with whatever it is you've spent...

    -Updated (pname is the setting which you will pass)

    UPDATE test_1 SET name =: pname

    OÙ «, » || name | ',' LIKE '%', | : pname |', %';

    -Test cases

    -Passing the value of the parameter in the form "a".

    SQL > pname VARIABLE VARCHAR2 (1);

    SQL > EXEC: pname: = 'a ';

    PL/SQL procedure successfully completed.

    -Before the update

    SQL > SELECT * FROM test_1;

    NAME

    ----------

    a, b, c

    d, e, f

    -Updated the line given by "a".

    SQL > UPDATE test_1 SET name =: pname

    2. WHERE «,» | name | ',' LIKE '%', | : pname |', %';

    1 line update.

    -After the update

    SQL > SELECT * FROM test_1;

    NAME

    ----------

    one

    d, e, f

    SQL > ROLLBACK;

    Complete restoration.

    SQL > SELECT * FROM test_1;

    NAME

    ----------

    a, b, c

    d, e, f

    -Value of the parameter as 'b '.

    SQL > EXEC: pname: = 'b ';.

    PL/SQL procedure successfully completed.

    SQL > UPDATE test_1 SET name =: pname

    2. WHERE «,» | name | ',' LIKE '%', | : pname |', %';

    1 line update.

    SQL > SELECT * FROM test_1;

    NAME

    ----------

    b

    d, e, f

    SQL > ROLLBACK;

    Complete restoration.

    SQL > SELECT * FROM test_1;

    NAME

    ----------

    a, b, c

    d, e, f

    -Value of the parameter as 'c '.

    SQL > EXEC: pname: = 'c ';

    PL/SQL procedure successfully completed.

    SQL > UPDATE test_1 SET name =: pname

    2. WHERE «,» | name | ',' LIKE '%', | : pname |', %';

    1 line update.

    SQL > SELECT * FROM test_1;

    NAME

    ----------

    c

    d, e, f

  • Customized using regexp check constraint

    Oracle 11.2.0.1

    I need a customized using regexp expressions check constraint.  We have a single column in our table REGNO, which is used to keep the registration number of our customers.  It has alpha and numeric values, the first is Alpha and rest is digital with preceding zeros as A0100 A1245, C1111 etc.  Sometimes, in the application user enters regnos evil if we want to stop entering the bad regnos i.e. assume that the user name is Ashok Kumar and in the series, we have 1000 users so this new user should have A1001 (other than any value A1001, in this example, the constraint must be limit to enter the value) only, not the others nor a1001 , A1000, nor A1002 or < has no > 1001 too. Rather than having 26 sequences (A to Z), we get a table where we have these columns:

    Alpha char (1), number of LastNo.  But sometimes a user enters wrong number value and stores it in the table, so next time for the same gap alpha arrives and confusing.

    So, we must have a constraint of database level so that ONLY the correct values must be entered.

    Kindly help me how I have this task please.

    Thank you.

    If REGNO is a derived value then why let you the user enter a value. Just generate the user.

  • RegExp search and replace, keep the formatting of the original text

    Hello!

    Will have to perform the Search and replace within a framework of text using RegExp.

    And to retain the original formatting of the text block.

    How is it possible?

    Bad example-, it converts all the text formatting to the format of the first character:

    var reg = /a/gmi;
    var replacer = '*';
    var fr = activeDocument.textFrames[0];
    fr.contents = fr.contents.replace (reg , replacer);
    

    find_and_replace_regexp.jpg

    Thank you!

    I has not yet been tested your code.

    But why you did not play with my code snippet, use something like this:

    // regex_changeContentsOfWordOrString_RemainFormatting.jsx
    // regards pixxxel schubser
    var s = /arguments/gi;
    var replacer = "other string", result;
    var atf = activeDocument.textFrames[0];
    
    while (result = s.exec(atf.contents)) {
        try {
            aCon = atf.characters[result.index];
            aCon.length = result[0].length;
            aCon.contents = replacer;
            } catch (e) {};
        }
    

    Try it and have fun

  • regexp help

    Hello

    I need to extract deposited number. Can please help me this extract using regexp.

    for ex:

    at the bottom of the message, I need to extract the value 434234234235435345634345 using REGEXP

    ORA-20102: cw_upload_queue_item_meta | ec3_unique_file_ref:434234234235435345634345 | ORA-00001: unique constraint (IBIS. CW_UPLOAD_QUEUE_ITEM_META_PK) violated

    user575115 wrote:

    Thx.It works in 11g, 10g too error throw

    That's why you have to mention your db version 4-digit during the validation of the questions:

    Select

    LTRIM (regexp_substr ('ORA-20102: cw_upload_queue_item_meta | ec3_unique_file_ref:434234234235435345634345 |)) ORA-00001: unique constraint (IBIS. ((CW_UPLOAD_QUEUE_ITEM_META_PK) violated ',': [^ |] +', 1, 2),': ')

    f

    of the double

  • IAM facing problems sql query regexp

    Hi all

    under custom query note here is the type of clob data in table

    value of the field personalized note is exists table Anshu Udainiya the value tag iam using the regular expression to replace

    Select org_prog_cam_id, ndc_no, REGEXP_REPLACE (trim (to_char (custom_note)),' < [^ <>] + > ') custom_note

    from DTC_AAG_NDC_NOTE_STAGING where org_prog_cam_id = 6696 and ndc_no = '51248015003'

    less

    Select 6696, '51248015003', to_char ('sdfsfsdfsd'))

    of the double

    first query of exit

    ndc_nocust1cust2
    51248015003< p > < span style = "color: #00FFFF" > < strong > < span style = "font-size: 16px" > < span style = "background-color: #FFD700" > Anshu Udainiya </span > < / span > < / strong > < / span > < /p >16

    second length of request of personalized note

    Choose the length (REGEXP_REPLACE (trim (to_char ('Anshu unmar')),' < [^ <>] + > ')) coz of the double

    coz

    -----

    14

    can you please help these for urgent need... Thank you very much

    Hello

    assuming that it is the only element between 2 beacons (between > and)<) ans="" that="" you="" are="" using="" at="" least="" 11g="" you="" can="" use="" regexp="" in="" this="">

    with t
    as
    (
    select '

    Anshu Udainiya

    ' str from dual ) select regexp_substr(str, '>([^<]+)<',1,1,null,1) txt, length(regexp_substr(str, '>([^<]+)<',1,1,null,1)) len from t; TXT LEN -------------- ---------- Anshu Udainiya 14

    Kind regards.

    Alberto

  • RegExp in a case of join internal

    Hi, I was expecting assistance regarding tent to match values using regexp because currently I seem to get an error. I created a set of dummy tables to give an idea of the problem that I am facing and here is the table create and insert the codes.

    
    CREATE TABLE "BAS_USERS" 
       ( "UID" VARCHAR2(20 BYTE), 
     "FIRSTNAME" VARCHAR2(255 BYTE), 
     "LASTNAME" VARCHAR2(255 BYTE)
       )
     
    Insert into BAS_USERS ("UID",FIRSTNAME,LASTNAME) values ('123456789','Humpty','D');
    Insert into BAS_USERS ("UID",FIRSTNAME,LASTNAME) values ('987654321','Mickey','M');
    Insert into BAS_USERS ("UID",FIRSTNAME,LASTNAME) values ('543212345','Minnie','M');
    
       
    CREATE TABLE "BAS_USERS_LOG" 
       ( "NOTES" VARCHAR2(255 BYTE)
       )
    
    
    Insert into BAS_USERS_LOG (NOTES) values ('TASK WAS ASSIGNED BY Humpty D (123456789) TO Mickey M (987654321) ');
    Insert into BAS_USERS_LOG (NOTES) values ('TASK WAS FETCHED BY Minnie M (543212345) ');
    
     
    

    What I'm trying to do is to try to take the name of the value of the field notes in my table of bas_users_log and try then to match it by using the CONCATENATE function to combine the first and last name, but for some reason that I get the following error:

    ORA-00920: invalid relational operator
    00920. 00000 -  "invalid relational operator"
    *Cause:    
    *Action:
    Error at Line: 12 Column: 5
    

    The SQL Code I wrote is this:

    
    SELECT
        *
    FROM
        BAS_USERS_LOG B
    INNER JOIN 
        BAS_USERS D
    ON
        CASE
            WHEN (REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 8) ||' '|| REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 9))=' ' 
            THEN (REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(b.NOTES)),'-',''), '[A-Z]+', 1, 5) ||' '|| REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 6))
            ELSE (REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 8) ||' '|| REGEXP_SUBSTR(REGEXP_REPLACE(UPPER(TRIM(B.NOTES)),'-',''), '[A-Z]+', 1, 9)) 
    END AS B.PERSONNAME =(trim(UPPER(D.FIRSTNAME))|| ' ' ||trim(UPPER(D.LASTNAME)))
    ;
    

    Would appreciate it if someone could please advise where I'm wrong.

    Thanks in advance.

    just get rid of the column alias in your join condition (AS B.PERSONNAME)

    HTH

  • REGEXP: String normalization

    Hi all

    Is it possible to normalize a string using a REGEXP to follow this rule:


    1. If the string begins with BLOCO or LOTE channels, keep it in the beginning of the string.
    2. keep the first channel number
    3 - If the first number is followed (after a space) that a single character include the number
    4 - If the first number is concatenated characters keep the whole word.



    Examples of data with examples:

    WITH t AS
    (SELECT 'LOTE 1' input_string,
             'LOTE 1' output_string
        FROM dual
      UNION ALL
      SELECT 'BLABLA 1' input_string,
             '1' output_string
        FROM dual
      UNION ALL
      SELECT 'BLOCO 11 A 3' input_string,
             'BLOCO 11A' output_string
        FROM dual
      UNION ALL
      SELECT 'BLOCO 3A' input_string,
             'BLOCO 3A' output_string
        FROM dual
      UNION ALL
      SELECT '4 A' input_string,
             '4A' output_string
        FROM dual
      UNION ALL
      SELECT '5 AA' input_string,
             '5' output_string
        FROM dual
      UNION ALL
      SELECT 'LOTE 6 RC' input_string,
             'LOTE 6' output_string
        FROM dual
      UNION ALL
      SELECT 'LOTE 7-A' input_string,
             'LOTE 7-A' output_string
        FROM dual)
    SELECT *
      FROM t;
    
    

    Kind regards

    Manel

    Post edited by: Manuel Vidigal Typo in "BLOCO 11 A 3"output ".

    Then

    Select

    input_string

    output_string

    regexp_substr)

    regexp_replace (input_string, ' (\d) ([^ [: digit:]] (| $))', "\1\2", 1, 1)

    ,'(^ BLOCO. | ^Lote) [^ [: digit:]] * \d [^] * | \d[^] * "

    ) o

    t

    Some explanantion:

    First in the regexp_replace replace us (I modified it) the first occurrence of a followed by a space and a number digt not) with numbers and his successor non-chiffres.

    And then from there we take if the string begins with BLOCO or LOTE everything from the beginning selection until the first digit and after this figure in the next space or at the end if there is no following space.

    If there is no key words at the beginning only since the first digit comes from the same way as above.

  • RegExp is 10 x slower in Adobe Air

    This code run more slowly in Adobe Air 10 x:

    import flash.utils.getTimer;

    var str:String = "I'm a short string, I am a short string, I am a short string, I am a short string, I am a short string";

    var r: RegExp = /rt | tr | m | a | n/g

    var t:int = getTimer();

    var: string result;

    for (var i: uint = 0, n: uint = 100000; i < n; ++ i)

    {

    result = str.replace (r, ' |');

    }

    trace (getTimer () - t);

    trace (result);

    I run this code in Flash Player and Adobe Air (publication Mode, win 10 64-Bit, Dell Inspiron 3542) and get the result:

    Flash Player: 874 ms

    Adobe Air: 5461 ms

    I tested this code with CC to animate and develop Flash and get the same result. Sometimes I 10 x slower.

    I posted this problem here: Bug #4161031 - regular expressions (RegExp) is 10 x slower in Adobe Air

    This is a strange question. All this interest please do the test and report the result here?

    Thank you!

    Hello

    AIR SDK 22 looks good, can you use it?

    -Roshan

  • How to search for a string in a column using REGEXP


    Hi Forum,

    I have a table with a column that has records that contain one of the 3 words viz.

    TABLE X

    col1

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

    remit_method = EMAIL/remit_details = some other details

    remit_method = SMS/remit_details = some other details for sms

    remit_method = POST

    I need to write a SQL that captures the remit_method of the column. I wrote SQL using SUBSTR and INSTR to capture him. But I was wondering if I could do it using the functions of RegExp as well?

    SELECT REGEXP_SUBSTR (col1) == > how?

    Of

    (

    SELECT ' remit_method = EMAIL/remit_details = FROM DUAL some other details

    UNION

    SELECT ' remit_method = SMS/remit_details = some other details for FROM DUAL of sms

    UNION

    SELECT 'remit_method = POST' FROM DUAL

    ) ;


    Output must be

    1st row = > EMAIL

    Row2 = > SMS

    Row3 = > POST

    Thank you

    Maëlle

    Like this...

    SQL > ed
    A written file afiedt.buf

    1 with tablex as (SELECT ' remit_method = EMAIL/remit_details = col1 OF DOUBLE UNION some other details)
    2. SELECT ' remit_method = SMS/remit_details = some other details OF UNION of the sms for DOUBLE
    3. SELECT 'remit_method = POST' FROM DUAL
    4                 )
    5 SELECT REGEXP_REPLACE (col1, ' ^ remit_method =([[:alpha:]]+). * $', '\1') as remit_method
    REGEXP_REPLACE 6, (col1, ' ^. * remit_details =(.*) $ |. *', '\1') as remit_details
    7 * FROM tablex
    SQL > /.

    REMIT_METHOD REMIT_DETAILS
    -------------------- ----------------------------------------
    A few other details by E-MAIL
    Publish
    Other details for sms SMS

  • REGEXP question

    I'm trying to match, verify via REGEXP_LIKE:

    "start - something - dot - something - point - something - dot - something - end dot - digit numbers [---]-" / / or described differently *. * .digits [---] *. * .digits

    So for example the following must "match" 'I2.2.2[-]3.4.2', ' 1.1.3 1.1.4 of the[-]','1.2AA.3 [---] 1.2AB.4'

    but does not correspond to the following: "[-] 1.3 1.4 '.

    Somehow, I got lost in all the attempts to do right and ended up upward with solutions or scenarios or no match at all for the...

    The following seems to work as long as I do not add the ^ or $ signs... Someone at - it an idea?

    Select the check BOX

    WHAT model = 'X' AND 'FIT '.

    WHAT model <>'X' THEN 'NO MATCH'

    ANOTHER dummy

    End UP like "IS this IS IT? ''

    of the double

    where REGEXP_LIKE ('I2.2.4 [-] 3.2.44',' (\d+|\D+)\. () \d+|\D+)\.\d+\[\-\](\d+|\D+)\. (\d+|\D+)\.\d+');

    Version of database 11.2.0.3 EE

    Thank you.

    with t as)

    Select 'II.17B.2 [---] II.17B.4' double str

    Union of all the

    Select ' 3.2 [---] 3.4 ' double

    )

    Select

    *

    t

    where REGEXP_LIKE (str

    --                 ,'^(\d+?| \D+?*\.) {2}\d+?\[\-\]\d+?| \D+?*\.\d+?| \D+?*\.\d+?$'

    ,'^([^.] +\.) {2}\d+\[-\]([^.] +\.) \d+$ {2}'

    );

    Your regexp invites me to analyze it, so I give you only one solution.

    Just try to implement your needs forward and avoid things like. * ? If possible.

    During the construction, it is often useful to consider negative expressions regexp characterclasses.

    If your condition can be rewritten in the form

    'end of-no dots - dot - non-dots - dot - figures of the non-dots - dot - non-dots - dot - figures - [---] to start' / / or described differently *. * .digits [---] *. * .digits

    Well, I have to admit that the hypothesis "something = non-points" is a guess, but if it is a problem we can relax the cardinalities with {2}.

  • RegExp associated


    Hello

    I'm new to regular expressions and I learn the techniques, can help me by telling more about branch reset the group in regex with some examples.

    From what I can understand of their article, it's something like that...

    Oracle: -.

    (?| ABC | ((d) (e) (f) | g (h) i)
    |      \_/\_/\_/  \_/
    |       |  |  |    |
    |       |  |  |    \--backreference 5
    |       |  |  |
    |       |  |  \--backreference 4
    |       |  |
    |       |  \--backreference 3
    |       |
    |       \--backreference 2
    |
    |
    \--------------------/
    |
    backreference 1

    Perl with branch Reset group: -.

    (?| ABC | ((d) (e) (f) | g (h) i)
    \_/\_/\_/  \_/
    |  |  |    |
    |  |  |    \--backreference 1
    |  |  |
    |  |  \--backreference 3
    |  |
    |  \--backreference 2
    |
    \--backreference 1

    Thus, the difference with the direction General Reset group is that each condition "OR" in the expression returns the backreferences 1, matches any group of GOLD allows the first element of backreferenced within this group to be named backreference 1, the second backreference as 2 and so on.

    In existing features of regexp in Oracle, it is one of the common problems (and probably why this feature has been introduced, but not in 11g as far as I can tell), each hook opening just increments the backreference, regardless of what group of GOLD, there is within the.  Which can make it very difficult to have a singular expression or matches, where you can reference the correct backreferences when you for example a regexp_replace.   The other problem with the current functionality is that the backreferences are limited of numbers from 1 to 9, so often we end up resulting using several RegExp functions to achieve what we want.  This new feature will definitely help (if oracle implement) as back-references are better interpreted and delivered to zero for each group.

  • Need help with the regexp

    I am trying to run the query in oarcle apps and wanted to select lines, that meets the multiple org code separated by and my input value is 127 123, it will convert to ('127 ', ' 123') this regexp

    Select * from ORG_ORGANIZATION_DEFINITIONS where organization_code IN (select ' ('| regexp_replace (regexp_replace (regexp_replace (: p_inv_org_code, '() + ',','), ',' "'," '),'^ | $', "') |')) (' double)

    -NGO

    Hello

    This is the forum for the SQL Developer tool. Any questions about SQL or PL/SQL problems please post in SQL and PL/SQL

    Concerning

    Marcus

  • RegExp with padding for the numbers

    Hi all

    I have a column VARCHAR2 representing Article and paragraph of a document and I need to sort in a sophisticated this column method.

    The problem is that because this value is from a form using free text, the format is quite heterogeneous. Then we would have something like:

    select '1' as section from dual union all
    select '7(1), 8(3)' as section from dual union all
    select '9(2)(b)' as section from dual union all
    select '11(1)(c)' as section from dual union all
    select 'Annex VI' as section from dual;
    

    the problem is that if we use the lexicographical order, that we'd end up with 11 front of 9.2 b (1)

    select  section from (
    select '1' as section from dual union all
    select '7(1), 8(3)' as section from dual union all
    select '9(2)(b)' as section from dual union all
    select '11(1)(c)' as section from dual union all
    select 'Annex VI' as section from dual)
    order by 1;
    
    SECTION
    ----------
    1        
    11(1)(c) 
    7(1), 8(3)
    9(2)(b)  
    Annex VI 
    

    It is true that articles go not beyond say 1000 thought I replace all the groups of digits of 0 left padded values. An expression that I would get the right result

    select  section from (
    select '001' as section from dual union all
    select '007(001), 008(003)' as section from dual union all
    select '009(002)(b)' as section from dual union all
    select '011(01)(c)' as section from dual union all
    select 'Annex VI' as section from dual)
    order by 1;
    

    SECTION

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

    001

    007 (001), 008 (003)

    009 (002) (b)
    011 (01) (c)
    Annex VI

    This can be achieved with regexp?, the thing is I can locate the numbers and normally the depth of numbers would be only 2 directions 1 (2) and no 1 (2) (3) so with 2 nested regexp_replace could be good. The thing is that I don't realize to fill in the 3rd parameter:

    Best regards

    Hello

    Using REGEXP_REPLACE to fill in the numbers:

    SELECT section

    , REGEXP_REPLACE (REGEXP_REPLACE (section - for debugging only

    , '(\d+)'

    , "000\1".

    )

    , « 0+(\d{4}) »

    , '\1'

    ) AS sort_str

    ARTICLE

    ORDER OF REGEXP_REPLACE (REGEXP_REPLACE (section

    , '(\d+)'

    , "000\1".

    )

    , « 0+(\d{4}) »

    , '\1'

    )

    ;

    The inner REGEXP_REPLACE adds 3 major 0 ' to all numbers, so that all the numbers are at least 4 digits.

    Removes from the external REGEXP_REPLACE 0 ' to all numbers, so that all numbers are exactly 4 digits.

    In Production, you will not want to repeat the expression in the SELECT clause. I just did here to help us see what's going on.

    Output:

    SECTION SORT_STR

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

    1 0001

    7 (1), 8 (3) 0007 (0001) 0008 (0003)

    9 2 b 0009 (0002) (b)

    11.1 c 0011 (0001) (c)

    Annex VI to annex VI

Maybe you are looking for