extract numbers only by regexp_substr

Hi all
I want to get all the numbers, but do not include ' - '.
example of
  with t as (select '12-12-2000'from dual union all
            select '12' from dual union all
      select '17.12' from dual union all
              select 'February 2008' from dual union all
              select '3 05 2010') as txt  from dual

              )
    --
    select regexp_substr(txt,'[^- ][0-9.]*') from t;
expected results
only don't ranks No 2 and no ranks No 3
12 
12.17
others do not need...

concerning

Published by: Isabelle January 11, 2013 01:26

Try as...

with t as
(select '12-12-2000' val from dual union all
select '12' from dual union all
select '17.12' from dual union all
select 'February 2008' from dual union all
select '3 05 2010' from dual)
select val from t where not regexp_like(val,'[-]|[ ]')

Tags: Database

Similar Questions

  • my password is 10 digits, I can't type 10 numbers only four password

    my password is 10 digits, I can't type 10 numbers only four password

    Of course you won't tell the password to four digits?

  • extract numbers

    Hello
    I am trying to extract only those string SSN numbers. Not sure why this expression does not work?
    WITH T as
    (SELECT '222-22-1111' test_string FROM DUAL union all
    SELECT '333-33-2222' FROM DUAL union all
    SELECT '232-22-2222' FROM DUAL)
    SELECT REGEXP_SUBSTR(test_string,'[^-]*') FROM T 
    It extracts only the first 3 digits when I need all 9 digits without hyphens.
    222
    333
    232

    You can use the REPLACE, assuming that you will always have one - in the SSN

    SQL> WITH T as
        (SELECT '222-22-1111' test_string FROM DUAL union all
        SELECT '333-33-2222' FROM DUAL union all
        SELECT '232-22-2222' FROM DUAL)
        SELECT replace(test_string,'-') FROM T
    
    REPLACE(TES
    -----------
    222221111
    333332222
    232222222
    

    SS

  • Extract numbers from a string

    Hello
    i'numbers in the neck of string arrecnote

    Please help me in this...

    Published by: smile on October 7, 2010 05:33

    Published by: smile on October 7, 2010 06:14

    Try this to extract the numbers from a string:

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'hello-cycle monthly settlement;  865.15 SDR
      2  
    multilat net 218.15 (USD) USAWW-USACC-2007/10' col1 from dual) 3 SELECT * FROM 4 (SELECT REGEXP_SUBSTR(col1,'[0-9]+.[0-9]+',1,lvl) col1 FROM 5 (select col1,level lvl 6 from t 7 connect by level <= LENGTH(col1) - LENGTH(REPLACE(col1,' ')) + 1)) 8* WHERE col1 IS NOT NULL SQL> / COL1 -------------------------------------------------------------------------------- 865.15 218.15 2007/10 SQL> -- or if you just want the numbers with its decimal SQL> ed Wrote file afiedt.buf 1 with t as (select 'hello-cycle monthly settlement; 865.15 SDR 2
    multilat net 218.15 124 (USD) USAWW-USACC-2007/10' col1 from dual) 3 SELECT * FROM 4 (SELECT REGEXP_SUBSTR(col1,'[0-9]+[.][0-9]+',1,lvl) col1 FROM 5 (select col1,level lvl 6 from t 7 connect by level <= LENGTH(col1) - LENGTH(REPLACE(col1,' ')) + 1)) 8* WHERE col1 IS NOT NULL SQL> / COL1 -------------------------------------------------------------------------------- 865.15 218.15 SQL>

    Published by: AP on October 7, 2010 05:43

  • How can I change a file of numbers only from view?

    I need to modify a file of numbers, but it seems to be 'view only' as editing is not possible. What should I do to change this file?

    I'm guessing that you didn't post a screenshot or provide details that the file has been saved in print preview mode.  Click on the 'OK' button at the bottom right.

  • Extract numbers in a table of char

    Hello

    I'm with LabWindows/CVI to read data from a serial port.  I read the values with ComRdTerm, and they are stored in a char array, the

    Table looks like this "1024 576 123 756. I need to extract the figures in this table.

    ANSI C sscanf () and formatting functions and the IO Library Scan () are the instrument that you can use to retrieve your numbers. A good C manual will explain the first command and its options, while the second, there is a good description in the online help.

  • Hi, XI - Win 7 64 bit.  AR prints only the even numbers when I allowed of the odd numbers only :-(

    Hi hope you can help.

    AC' reader XI (win 7 64 bit).   I expected that a series of pages of odd number only, but only prints even numbers.

    Tried several sets of tests, but still prints even pages.   It is a PDF of a new Casio keyboard manual from their site.  I can read

    the PDF on my computer and can print single pages, but the above problem is disconcerting.  ~ Thank you if you can offer any help.

    see you soon

    Thanks, MVP for your quick response.

    Yes, I tried now opt to print even pages only in the range of 1 to 8 and now it prints the odd numbers. Hey Hey

    Well, for the sake of my sanity, I'll take a break for some sponge cold and some chanting and then return refreshed.

    EDIT - SOME TIME LATER: well, thanks for any help, greatly appreciated.

    Now I see what the problem is, thanks for the explanation page numbers cordially.

    Looks like Adobe Reader made its own system of numbering pages before printing.

    Would have liked to wear to try, but did not want to destroy half of a forest.   Presented the PDF document on the local printer instead. quite.  :-)

    Very much appreciate your help. Think I'll stay for the simple printing of the page (no double-sided) in the future.  See you soon.

    Harold

  • extract DDL ONLY!

    Somone know what parameter must be added to extract to allow the DDL ONLY?

    I didn't wan't and DML statement.

    Thank you very much!

    Hello
    You can use this parameter to the parameter extracted yhe

    INCLUDE DDL MAPPED
    IGNOREINSERTS
    IGNOREUPDATES
    IGNOREDELETES
    TABLE .*;
    

    Thank you
    Riyas

  • the force of txt for numbers only

    I am building an app that would be really nice if just type the user and only appears. is there a way to do this?

    I searched the forum and found a fix for css:

    put this in your class or inline css style:

    -wap-entry-format: "* N".

  • Extract numbers and count their time

    Oracle 10.2.0.1
    Windows xp

    Table 1 is given below:
    Region  Region_Name   Sales_Allowed (This is also codes of region)
    01      R1            26,19,30,04,10,20
    02      R2            15,18,01,34,30,10,26,50
    03      R3            45,80,12,02,01,48,77
    04      R4            11,22,50,26,19,06,45
    05      R5
    ..
    ..
    80      R80           12,13,14,15,77
    Total 80 regions and maximum sales_allowed is of 20 regions; I mean it can't be more than 20 regions in a region where the sale is permitted.

    My needs:

    1. what region is to have Sales_allowed above. In the example above 02 has maximum
    regions in it.

    2. If I want to know how many times plain is coming in the table as sales_allowed, something like in the example above 26 happens 3 times (01,02 and 04), may be that other regions are coming 10 times in different lines; so, I want something like:

    Output based on the example above, please:
    Region    Times
    01        0
    02        1
    03        0
    04        1
    05        0
    06        1
    ..
    26        3
    ..        <N>
    I'm sure that this issue is in the forum, but couldn't find the exact/near solution...

    Thank you.

    Or is it more like this?

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select '01' as Region, 'R1' as Region_Name, '26,19,30,04,10,20' as Sales_Allowed from dual union all
      2             select '02', 'R2', '15,18,01,34,30,10,26,50' from dual union all
      3             select '03', 'R3', '45,80,12,02,01,48,77' from dual union all
      4             select '04', 'R4', '11,22,50,26,19,06,45' from dual union all
      5             select '80', 'R80', '12,13,14,15,77' from dual)
      6  --
      7  -- END OF TEST DATA
      8  --
      9  select x.rn as region, nvl(y.cnt,0) as cnt
     10  from   (select rownum rn from dual connect by rownum <= 80) x
     11         left outer join
     12         (select regexp_substr(sales_allowed,'[^,]+',1,rn) as region, count(*) as cnt
     13          from   t cross join (select rownum rn from dual connect by rownum <= 20)
     14          where regexp_substr(sales_allowed,'[^,]+',1,rn) is not null
     15          group by regexp_substr(sales_allowed,'[^,]+',1,rn)
     16         ) y
     17         on (x.rn = to_number(y.region))
     18* order by 1
    SQL> /
    
        REGION        CNT
    ---------- ----------
             1          2
             2          1
             3          0
             4          1
             5          0
             6          1
             7          0
             8          0
             9          0
            10          2
            11          1
            12          2
            13          1
            14          1
            15          2
            16          0
            17          0
            18          1
            19          2
            20          1
            21          0
            22          1
            23          0
            24          0
            25          0
            26          3
            27          0
            28          0
            29          0
            30          2
            31          0
            32          0
            33          0
            34          1
            35          0
            36          0
            37          0
            38          0
            39          0
            40          0
            41          0
            42          0
            43          0
            44          0
            45          2
            46          0
            47          0
            48          1
            49          0
            50          2
            51          0
            52          0
            53          0
            54          0
            55          0
            56          0
            57          0
            58          0
            59          0
            60          0
            61          0
            62          0
            63          0
            64          0
            65          0
            66          0
            67          0
            68          0
            69          0
            70          0
            71          0
            72          0
            73          0
            74          0
            75          0
            76          0
            77          2
            78          0
            79          0
            80          1
    
    80 rows selected.
    
    SQL>
    
  • Numbers only in field

    Jin

    I want to enter number only in the text field, not a character.

    How can I do that.


    Thank you
    Ed

    Hi Maury,

    You can do this by using JS.

    Put following code into the Page HTML Header

    
    

    And put away in the Page HTML Form Elememt element attributes section

    onkeypress="return isNumberKey(event)" 
    

    It could be that useful :-)

    See you soon
    Hari

  • Numbering only odd pages...

    ... but as: page 1 (the real page 1), page 2 (the real page 3), page 3 (the real page 5) and so on. …

    Thanks in advance!

    I consider not dragging the page. Try this:

    ============================

    -title of the folio mp text frame script

    Define slabel for a "a folio.

    Tell application "Adobe InDesign CS6"

    -a meter

    c Set to 1

    -check each page for mp items labeled folio and substitute

    Repeat with x in each page of the active document

    -replace the existing elements of MP

    Try

    delete substitution (point 1 of each element of x page whose label is slabel)

    try to end

    mpfolios the value of the elements of x-master page

    Repeat with i in mpfolios

    If i label is slabel then

    I have replace the destination page x

    end if

    end repeat

    -define the content of the text folio at the counter block

    Try

    the value c (article 1 of each page element of x whose label is slabel content) as string

    set c to c + 1

    try to end

    end repeat

    tell the end

  • extract characters only

    I have a string ' CITY - NAME: NEW DELHI 12345'

    I want characters like "CITYNAMENEWDELHI".

    Try

    SELECT REGEXP_REPLACE ("CITY - NAME: NEW DELHI 12345', ' [^ A - Z]'," ") double;

    or

    SELECT REGEXP_REPLACE ("CITY - NAME: NEW DELHI 12345', '(*[^[:alpha:]])'," ") double;

  • How to restrict user entered numbers/extracts only numbers

    qst1- I use a text input (flash component) to which the user will enter numbers only in (the integers and floating-point numbers) but not any other symbol.

    Copy the following code


    on keyDown me

    If ("1234567890 -") contains the key or the key = backSpace or key = tab keyCode = 123 or the keyCode 124 = then
    Pass
    on the other
    stopEvent
    end if

    end

    works fine when I use it with old text style of the fields to the Director. However, it does not work with the new flash component style (text).

    QST 2- and, possibly, very simple problem:

    I have an another text field that the user must enter numbers (integers or floating-point number), separated by a comma. Then after the button presses to calculate a mathematical operation on them.

    What I need is access to the numbers only (and not commas) in a list then do some math advanced on these figures.

    How can I write a piece of code for this?

    My own code


    Repeat with i = 0 to nPoints-1
    xList.append (float (xTmp.char [2 * i + 1]))
    end repeat

    (where he resumed (2 * i + 1) odd number entered (e.g. 1. 3 5. ..., because I know that users start with the first number in position 1 then separate with comma second number gets 3. position,...)

    As said it does the job only if the whole written user and the code does not work when the user enters decimal numbers.

    Any suggestion/help is appreciated?

    Best regards!

    HUMAN RESOURCES

    QST 2

    I have an another text field that the user must enter numbers (integers or floating-point number), separated by a comma. Then after the button presses to calculate a mathematical operation on them.

    What I need is access to the numbers only (and not commas) in a list then do some math advanced on these figures.

    How can I write a piece of code for this?

    Have you considered text segmentation in defining 'itemDelimiter' and then grabbing point-by-point? For example:

    aString = "1,2,3,4,5,67,3.1415"
    the itemDelimiter = ","
    put aString.item.count
    -- 7
    put aString.item[7]
    -- "3.1415"
    
  • How to extract the images filled in numbers?

    Hello community,

    I have prepared a file number for one of my clients with basic information and photos of products. I now need to export to Excel, but it does not keep the images which were filled in the cells of the numbers.

    Is there a way to extract the images of cells of numbers? I took these pictures on the internet directly, so I have stored them in a special place. I think, however, that they could be stored somewhere on my mac but cannot find them.

    I have over 300 images inserted in 300 cells, so I'll try to avoid to find their return and save them properly.

    Thanks for your help!

    I've tried in the past to extract numbers background images but never succeeded.

    I know that when you click on a cell and command + c to copy the content to the system Clipboard background images is included, because you can also click and command + v to paste the images follow the dough.

    But how the numbers stores the image to the system Clipboard when you copy and paste is not, as far as I know, documented.  It is so difficult to "get to work."

    If you are handy with AppleScript, you can try + command + c to copy and then run this script.

    the Clipboard as record

    This will list the contents of the Clipboard.  Give more information on how the image is stored in this folder could make it possible to shape a script to extract the images.

    But that is as far as I'm away.

    The folks at Mac OS technology discussions might know how.

    SG

Maybe you are looking for