Removes all characters except numbers

Hi all

I want to reformat to following phone numbers. As you can see it in what follows, I want to delete all characters except numbers and it does not start wirh 0 0 at the beginning of the f-number. And the length is 11. What do you recommend?

(543) 456-35-50 = > 05434563550

(555) 555-55-55 = > 05555555555

(210) 111-11 / 11 = > 02101111111

Thank you

Hello

3018678 wrote:

Hi all

I want to reformat to following phone numbers. As you can see it in what follows, I want to delete all characters except numbers and it does not start wirh 0 0 at the beginning of the f-number. And the length is 11. What do you recommend?

(543) 456-35-50-online 05434563550

(555) 555-55-55-online 05555555555

111-11 / 11 (210)-online 02101111111

Thank you

To remove all characters except the 10 digits, you can use REGEXP_REPLACE

REGEXP_REPLACE (str, '\D')

To put a "0" at the beginning of the string (if it isn't already begin with a '0'), you can use REGEXP_REPLACE even once:

REGEXP_REPLACE (REGEXP_REPLACE (str, '\D')

, '^([^0])'

, "0\1".

)

I don't think that there is a way to do both things wih a single integrated function call.

There is a requirement on the length being 11?  What happens if that comes into conflict with one of the other requirements?  For example, if the string is already long of 11 characters, but does not begin with a '0', do you want to add a "0", which makes 12 characters?  What happens if the length, after removing the numbers no, is very small, say 1?  (You can use LPAD adds however many ' 0 s you need.)  If the length (after removing the numbers) is 12 or more?  What happens if the string does not contain any what numbers at all?

If these things are questions, then post CREATE TABLE and INSERT statements for some examples of data, accurate results, you want that data, and explanations.

Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

Tags: Database

Similar Questions

  • How use Bridge to rename the batch to remove all characters after the 32nd character?

    I would like to batch rename to remove all characters after the 32nd character. Is this possible?

    Substitution string use with use of regular expressions is selected.

    In the use of the search field

    ^(.{32})(.*)
    

    In the field using replace

    $1
    
  • [basiljs] remove all pages except one

    In a script, I create pages, export to PDF, remove pages and then create a new etc.

    Right now I use this:

    [code]

    for (var j = b.pageCount (); j > 1; j-) {}

    b.removePage (j);

    }

    [/ code]

    But it's really slow. I think that indesign made many calculation after deleting a page (deadline: link textfields) so it would be more efficient to remove all pages at once.

    Now my question is how do?

    I tested and if I delete about 5500 empty pages with the script it takes about 8 minutes.

    If I select all in indesign, and then delete it takes about 10 seconds.

    Another way to speed up a litle is to erase all the content. It will take a long time but probably a bit faster.

    Thing is that I have

    b.Clear (b.doc ());

    but this removes the master page as well and I need to keep the master page.

    In short, how to remove all pages (except one since indesign needs a single page) at the same time?

    Hello

    I will remove a lot of pages in indesign with

    • Use documentPreferences.pagesPerDocument (faster)
    • use while loop or for
    • Close doc without saving changes, and then open again. (in some cases)

    Here's the test code, run with old Macbook Air + CS5 + OSX10.7

    var pp = function (args) {
      $.writeln(args);
    }
    
    var remove_all_pages_use_pref = function (doc) {
      pp("start deleting (use preferences)");
      $.hiresTimer;
      doc.documentPreferences.pagesPerDocument = 1;
      pp("end deleting");
      pp($.hiresTimer);
    }
    
    var remove_all_pages_use_loop = function (doc) {
      var i = doc.pages.length;
      pp("start deleting (while --)");
      $.hiresTimer;
    
      while (i--) {
        if (i==1) {break;}
        doc.pages[i].remove();
      }
      pp("end deleting");
      pp($.hiresTimer);
    }
    
    function main() {
      var doc = app.documents.add();
      $.hiresTimer;
      doc.documentPreferences.pagesPerDocument = 5500;
      pp('# create 5500 pages');
      pp($.hiresTimer);
      var indd = new File("~/Desktop/5500.indd");
      doc.save(indd);
    
      pp("------------");
      remove_all_pages_use_pref(doc);
      doc.close(SaveOptions.NO);
    
      pp("------------");
      pp("# try another way");
      var doc2 = app.open(indd);
      remove_all_pages_use_loop(doc2);
      doc2.close(SaveOptions.NO);
    }
    main();
    

    result

    # create 5500 pages
    30395026
    ------------
    start deleting (use preferences)
    end deleting
    28215999
    ------------
    # try another way
    start deleting (while --)
    end deleting
    268641063
    

    Thank you

    mg

  • Remove all lines except 10 random lines

    Hello

    How to remove all the lines in the JOBS table except 10 lines at random?

    Someone asked him before (not here...): http://stackoverflow.com/questions/10820105/t-sql-delete-except-top-1

    but I didn't get the answer, and I don't think it will work in PL/SQL.

    If the answer to StackOverflow's works in PL/SQL, I will be happy if someone explains me with a better example.

    If the answer to StackOverflow does'nt work in PL/SQL, I will be happy if somebody give me an example.

    Thank you!

    Try this

    delete from jobs where rowid not in (select rowid from jobs where rownum <= 10)
    
  • userChrome.CSS - remove all toolbars except front/rear, refresh and home

    I need to configure firefox in almost-kiosk mode. I want to disable all toolbars except for the "back" button, next button, refresh and home buttons.

    I did find something that allows you to hide the bookmarks toolbar. And if I keep at the entrance of #urlbar, front and rear buttons appear, but do not work (they're grayed out)?

    That's what I have so far:

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
    #searchbar {
    	display: none;
    }
    #main-menubar  {
    	display: none;
    }
    #urlbar  {
      display: none;
    }

    You can hide the Bookmarks Toolbar window and customize with these identifiers:

    #PersonalToolbar { display:none!important; }
    #CustomizeToolbarWindow { display:none!important; }
    

    ID #personal - brand - pages is for the bookmarks toolbar item that can be placed on a toolbar through the window customize.

    Try to drag the URL bar and search and other items that you hide in the toolbar palette.

    It seems in the history of the button B/F run after a reboot.

    It is usually best to use the DOM Inspector to get the ID or class of items of toolbar names.

  • Function to remove special characters in a column.

    Hi all

    In one of my column, we get special characters, as well as others. The data are extracted and loaded through Informatica. We are not face any problem while loading into the target, but when we try to extract these data through the report, it fails with the error:

    ORA-29275: partial multibyte character sets

    When we check this column, we find the special characters. Initially, we have implemented logic with the CHR to replace these NULL values. But every time we get different values. To make the permanent solution, we decided to remove all characters except available on Board of the key.

    Now, to this end, I need to write a function in Oracle's PL/SQL. I do not know more easy way from there to achieve. If I go with the CHR() function, I have to write for all these characters, which I think is not the right solution.

    Enjoy, if someone can help me identify the function or the way to get there.

    Thanks in advance.

    Hello

    AceNovice wrote:

    ... we have decided to remove all characters except available on key board...

    It depends on your keyboard.

    All that is on the keyboard you, something similar to this shoud work:

    REGEXP_REPLACE (string_column

    , '[^]0-9A-Za-z~!@#$%^&*()_+`={}| [\:";'' <>?,./-]'

    )

    This will return a copy of string_column, but with all the characters that are not not in the 2nd deleted argument.

    [Inside the brackets, ']' must come first (immediately after the ' ^') and '-' must come last.

  • remove special characters

    Hello

    How to remove special characters except '-'',' '. " in a string.

    Database: 10g

    Thank you

    Hello

    For example, use the REGEXP_REPLACE

    REGEXP_REPLACE (str

    , '[^-,.]'

    )

    I hope that answers your question.

    If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.

    In the case of a DML (UPDATE), for example, the sample data should show what looks like the tables before the DML, and the results will be the content of the or the tables changed after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • Remove unnecessary characters, space and channel numbers

    Oracle 11.2.0.1

    Windows

    I have data from the table like this:

    David Parker

    Robert Josh

    Hick 1/4

    John ' Fowler

    Bill.Gates

    Herman Patrick «»

    Andrew % Clark

    I want to delete all the numbers, special characters, more than one space between the words and make the correct name.  How can I remove extra characters from string.

    In fact, we get data that has sometimes special characters, including numbers and more spaces in name and it still creates a bad output query.

    Thank you.

    Or...

    SQL > t

    2 ALSO (SELECT "David Parker' DOUBLE str")

    3 UNION ALL

    4. SELECT 'Robert Josh' DOUBLE

    5. ANY TRADE UNION

    6. SELECT ' Hick' 1/4 OF the DOUBLE

    7 UNION ALL

    8. SELECT q ' [John 'Fowler'] ' FROM DUAL

    9 UNION ALL

    10. SELECT 'Bill.Gates' FROM DUAL

    11 UNION ALL

    12. SELECT q'[Herman 'Patrick']' FROM DUAL

    13 UNION ALL

    14 SELECT q'[Andrew % Clark]' FROM DUAL)

    15 SELECT regexp_replace (str, "[^ A-Za-z] + ',' '") final_str

    16 FROM t

    17.

    FINAL_STR

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

    David Parker

    Robert Josh

    Hick

    John Fowler

    Bill Gates

    Herman Patrick

    Andrew Clark

    7 selected lines.

    SQL >

  • How can I remove all numbers listed on my iMac FaceTime audio?

    I have along list of phone numbers on the audio portion of my set-up of FaceTime iMac.  These figures come from phone calls using my iPhone.  I can remove the entire list on my iPhone using the application of the edict, but am unable to find such an application on iMac FaceTime mounting.

    Thank you.

    Right click or Ctrl-click on the address window and choose Remove all recent.

  • remove all punctuation - only letters and numbers

    Hello

    How can I remove all the punctuation marks . As a result, only the letters and numbers stand ?


    Example:

    Chain before: "§ 67778 / % & $45-§§ 5FCGZZ-GZGUU(=&/+%/&%E$Dfcfhzb+++zvb).

    String that follows: 67778455fcgzzgzguuedfcfhzbzvb

    My Code so far:

    REPLACE)

    REPLACE)

    REPLACE)

    REPLACE)

    REPLACE)

    TRANSLATE)

    LOWER (TRIM (DESIGNATION))

    , '@-.', '@' )

    , ' ', '')

    , ' ', '')

    , '', '')

    , '-', '')

    CHR (10), ")

    Thank you for your help in advance

    2890953 wrote:

    How can I remove all signs of punctuation. Thus, only letters and numbers stand?

    Example:

    Chain before: "§%67778/%&45$$---§§$5FCGZZ-GZGUU (=&/+%/&%E$Dfcfhzb+++zvb.

    String that follows: 67778455fcgzzgzguuedfcfhzbzvb

    My Code so far:

    REPLACE)

    REPLACE)

    REPLACE)

    REPLACE)

    REPLACE)

    TRANSLATE)

    LOWER (TRIM (DESIGNATION))

    , '@-.', '@' )

    , ' ', '')

    , ' ', '')

    , '', '')

    , '-', '')

    CHR (10), ")

    In Oracle 10 and above, use regular expressions:

    SQL > select

    2 regexp_replace ("' §%67778/%&45$$---§§$5FCGZZ-GZGUU (=&/+%/&%E$ Dfcfhzb +++ zvb ',' [^ [: alnum:]]') s '")

    3 of

    4 double;

    S

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

    §6777845§§5FCGZZGZGUUEDfcfhzbzvb

  • How to remove special characters from the string using translate() without typing all special characters?

    Hi all

    I am trying to remove special characters without the help of regular expressions.

    translate (the column name or string,'!@#$ & * (* () _) * "" :} {?}) >? /, «, » ')

    I want to eliminate this manual process to give all special characters using a chr() or ascii() function.

    Please show me the way.

    Thanks in advance

    Similar to the solution of Michael...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select "[it comes of the #] [more amazing!") Test @# "$* & $%) assuming chain cost $ 5 000' double Str)
    2, i like (select level 1 c from dual connect by level<=>
    3 less
    4 Select + 32 (level-1) double connect by level<=>
    5 less
    6 select + 58 (level-1) double connect by level<=>
    7 less
    8 select + 91 (level-1) double connect by level<=>
    9 less
    10. Select 123 + (level-1) from dual connect by level<=>
    11 less
    12. Select 255 double
    13            )
    14, ts as (select level r, substr (str, level 1) c
    15 t
    16 connect by level<=>
    17             )
    18, tf as (select row_number() (order for r) r
    19                    ,ts.c
    20 TS
    21 I join on (i.c = ascii (ts.c))
    22             )
    23 select replace (sys_connect_by_path(c,'!'),'! ') Str
    24 TF
    25 where connect_by_isleaf = 1
    26 connect r = prior r + 1
    27 * start with r = 1
    SQL > /.

    STR
    -----------------------------------------------------------------------------------------------------------------------
    Thisisthemostamazingtest¸astringcosting5000

    Or something as horrible as this...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select "[it comes of the #] [more amazing!") Test @# "$* & $%) assuming chain cost $ 5 000' double Str)
    2, I like (select replace (sys_connect_by_path (chr (c), 'A'), 'A') as tr)
    3 of)
    4 select c, rownum r
    5 (select 32 + (level-1) as the double connection by level c<=>
    6                         union
    7 select + 58 (level-1) double connect by level<=>
    8                         union
    9 select + 91 (level-1) double connect by level<=>
    10 the union
    11. Select 123 + (level-1) from dual connect by level<=>
    12 union
    13. Select 255 double
    14 tri 1
    15                        )
    16                  )
    17 where connect_by_isleaf = 1
    18 log r = prior r + 1
    19 start with r = 1
    20            )
    21 select translate (str, 'A' |) TR, 'A') as str
    22 * t, I
    SQL > /.

    STR
    --------------------------------------------------------------------
    Thisisthemostamazingtest¸astringcosting5000

  • Script to remove all rows from a table except the first

    Please see the screenshots for the question/radio button I'm scripting.  If 'No' is clicked, I want to delete all lines except the first.  Therefore, if the first user clicks Yes, adds a bunch of lines and then click on no, I want all the extra lines should be deleted.  I use the script below, but it removes only half of the lines at a time.  I have to click No. 2 - 3 times to remove all the lines.  Appreciate any help!

    // remove extra rows that may have been added
    var rowCount = Page2.UserList.Table1._RowUserName.count;
    for (var i=0; i<rowCount; i++) {
      Page2.UserList.Table1._RowUserName.removeInstance(i);
    }
    
    

    LCD1.png

    lCD2.png

    Hello

    You can directly use the method setInstances of the instanceManager as follows:

    Page2.userlist.Table1._RowUsername.setInstances (1);

    I hope this will help you!

  • How to remove all the drives except 0:0 "Computer1" and re - joining "computer2" all disks

    Hello

    I need to find a way with PowerCLI can I analyze virtual named "machine1" across all the disks on a computer off, and detach all disks except the system disk (0:0).  Next, I would like to re - join these discs "computer2".  Seems to be there should be a way to do this using the Remove Disk command, but I don't know how I would keep track of all the disks as Computer1 can have a different number of disks attached whenever I run this script.  Can anyone help?

    CK

    Try something like that.

    $vmName1 = "vm1.

    $vmName2 = "vm2.

    $vm1 = get-VM-name $vmName1

    $vm2 = get-VM-name $vmName2

    $hd = get-disk hard - VM $vm1

    $cntrl = get-controller SCSI - VM $vm1

    $cntrl0 = $cntrl | where {$_.} {ExtensionData.BusNumber - eq 0}

    $hd | %{

    If ($_.) ExtensionData.ControllerKey - only $cntrl0. ExtensionData.Key - or

    $_. ExtensionData.UnitNumber - no 0) {}

    $vmdkFile = $_. File name

    Remove-hard drive - HDD $_ - confirm: $false

    New-disk-hard - VM $vm2 DiskPath - $vmdkFile - confirm: $false

    }

    }

    Note that the script does not take into account the original SCSI controller, it added the VMDK to the first SCSI controller

  • reduce the size of the seeds by car - remove ALL except the Base and last Incremental?

    I need to make a seed for a few VMs player.  but I don't need all of the incremental backups.   Is it safe to keep only the Base and the most recent Incrementaland remove all of the incremental backups between?  I think that this will help reduce the size of the seed and speed things up.

    I think that the answer is Yes.

    jordanl17,

    You do a range to remove and do what you're asking.

  • Order in characters not numbers

    Hello
    I need help with an order of data as below:
    select distinct First_Name
    from Name
    First_Name
    12345 Test
    25825 Apple
    14782 Bob
    1452 James
    I have to be able to just characters ascending classification
    not the numbers but the numbers are included in the value of the field.
    select distinct First_Name
    from Name
    order by First_Name asc
    should display this
    25825 Apple
    14782 Bob
    1452 James
    12345 Test
    but he will order to primes
    1452 James
    12345 Test
    14782 Bob
    25825 Apple
    Y at - it no logic so that the characters order by ascending order
    and the numbers are ignored when you perform the order in?
    The number will not always be a length of 5 or 3, it varies.

    Thanks for reading!

    Hello

    You can ORDER WITH a copy of a name that has all the numbers removed, like this:

    SELECT    first_name
    FROM       name
    GROUP BY  first_name
    ORDER BY  LTRIM ( TRANSLATE ( first_name
                                 , 'A0123456789'
                       , 'A'
                       )
              )
    ;
    

    LTRIM removes all space that can occur at the beginning of the string after that the numbers are deleted. Spaces that occur elsewhere are not affected.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

    Published by: Frank Kulash, June 16, 2011 10:37
    If you can not do SELECT DISTINCT, then ARRESTED BY something that is not in the SELECT clause, use GROUP BY instead of SELECT DISTINCT.

Maybe you are looking for