Removing specified between characters

Hi,
i want to remove between 0's from 'ODBILL000000000000000000001013'
i want 'ODBILL1013'
string can be 'ODBILL000000000000000000011014'
then i want 'ODBILL11014'

SQL> with t as (select 'ODBILL000000000000000000001013' str from dual union all
  2             select 'ODBILL000000000000000000011014' str from dual)
  3             select str, regexp_replace(str,'([[:alpha:]]*)0*(.*)','\1\2') new_str from t
  4  /
STR                            NEW_STR
ODBILL000000000000000000001013 ODBILL1013
ODBILL000000000000000000011014 ODBILL11014
SQL

Similar Messages

  • Removing spaces between characters using a loop

    How can I remove spaces between characters using a loop? I made a program that tests the validity of a social insurance number. However, I'd like to be able to remove the spaces in the input if the users sepeates their SIN using spaces. example (123 456 789 becomes 123456789)
    Thank you
    Edited by: umhodzic on Feb 10, 2008 2:43 PM

    umhodzic wrote:
    Thank you for your response. However, the procudre must be done using a loop.It doesn't have to be done using a loop, as already shown. However if you have some ignorant person telling you you have to have a loop, then here's a solution that uses a loop:String s = "123 456 789";
    while (s.contains(" ")) {
      s = s.replaceAll(" ", "");
    }

  • Removing alpha numeric characters

    Hi,
    Can anybody please tell me how can I remove the alpha numeric characters, inluding spaces from a column value.
    Thanks in advance

    Thanks for the help. But this extracts the alpha
    numeric characters and and print those. What I need
    is i want all those column values without these alpha
    numeric characters.You said...
    Can anybody please tell me
    how can I remove the alpha numeric characters, inluding spaces from a column value.So I showed you to to remove alpha numeric characters and spaces from a column value.
    So I think you need to be clear in your requirements.
    Do you want all rows where there are values that only have alpha numerics in them i.e. don't show the rows that have non-alpha numeric or spaces in a particular value?
    or
    Do you want all rows, but you want to strip out non alpha-numerics and spaces from particular values?
    Perhaps if you give an example of your data and what you expect the result to be that may give us a better idea, because what I gave you as a solution was correct for the requirement you specified.

  • Removing non english characters from my string input source

    Guys,
    I have problem where I need to remove all non english (Latin) characters from a string, what should be the right API to do this?
    One I'm using right now is:
    s.replaceAll("[^\\x00-\\x7F]", "");//s is a string having chinese characters.
    I'm looking for a standard Solution for such problems, where we deal with multiple lingual characters.
    TIA
    Nitin

    Nitin_tiwari wrote:
    I have a string which has Chinese as well as Japanese characters, and I only want to remove only Chinese characters.
    What's the best way to go about it?Oh, I see!
    Well, the problem here is that Strings don't have any information on the language. What you can get out of a String (provided you have the necessary data from the Unicode standard) is the script that is used.
    A script can be used for multiple languages (for example English and German use mostly the same script, even if there are a few characters that are only used in German).
    A language can use multiple scripts (for example Japanese uses Kanji, Hiragana and Katakana).
    And if I remember correctly, then Japanese and Chinese texts share some characters on the Unicode plane (I might be wrong, 'though, since I speak/write neither of those languages).
    These two facts make these kinds of detections hard to do. In some cases they are easy (separating latin-script texts from anything else) in others it may be much tougher or even impossible (Chinese/Japanese).

  • How to escape or remove the special characters in the xml element by regula

    Hi members,
    How to escape or remove the special characters in the xml element by regular expression  in java??
    For Example ,
    <my:name> aaaa </my:name>
    <my:age> 27 </my:age>
    In the above example , i have to retrieve the value of the <my:name> Element(For examlpe -- i have to get "aaaa" from <my:name> tag)...
    How to retreive this value by using DOM with XPATH in java
    Thanks in Advance

    Hi members,
    I forget to paste my coding for the above question....This is my coding......In this display the error...... Pls reply ASAP.......
    PROGRAM:
    import java.io.IOException;
    import java.util.Hashtable;
    import java.util.Map;
    import org.w3c.dom.*;
    import org.xml.sax.SAXException;
    import javax.xml.parsers.*;
    import javax.xml.xpath.*;
    public class DOMReaderForXMP {
         static Document doc;
         static XPath xpath;
         static Object result;
         static NodeList nodes;
         public DOMReaderForXMP() throws ParserConfigurationException, SAXException,
                   IOException, XPathExpressionException {
              DocumentBuilderFactory domFactory = DocumentBuilderFactory
                        .newInstance();
              domFactory.setNamespaceAware(true);
              DocumentBuilder builder = domFactory.newDocumentBuilder();
              doc = builder.parse("d:\\XMP.xml");
              XPathFactory factory = XPathFactory.newInstance();
              xpath = factory.newXPath();
         public static void perform(String path) throws Exception {
              result = xpath.evaluate(path, doc, XPathConstants.NODESET);
              nodes = (NodeList) result;
         public void check() throws Exception {
              perform("//my:name/text()");
              if (!nodes.item(0).getNodeValue().equals("application/pdf")) {
                   System.out.println("Mathces....!");
    ERROR:
    Exception in thread "main" net.sf.saxon.trans.StaticError: XPath syntax error at char 9 in {/my:name}:
    Prefix aas has not been declared

  • How to  remove the Special characters like @,#,$ ,..from field

    How to  remove the Special characters like @,#,$<,..from text  field. we nedd to remove any specila char from text field .
    ex:text  = just#fi%cation@text
    the text should be justification.

    hi check this ..
    data:char(25) value '5#4#2#&1#&',
         char1(9) .
           replace all occurrences of '#' in char with 'and' .
           replace all occurrences of '&' in char with 'num' .
         write: char.
    or use this..
    data:char(25) value 'test@ing*5#4#2#&1#&',
         char1(9) .
           replace all occurrences of '#' in char with space .
           replace all occurrences of '&' in char with space .
           replace all occurrences of '@' in char with space .
           replace all occurrences of '*' in char with space .
         write: char.
    regards,
    venkat.

  • Removing the Control Characters from a text file

    Hi,
    I am using the java.util.regex.* package to removing the control characters from a text file. I got below programming from the java.sun site.
    I am able to successfully compile the file and the when I try to run the file I got the error as
    ------------------------------------------------------------------------D:\Debi\datamigration>java Control
    Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal repet
    ition
    {cntrl}
    at java.util.regex.Pattern.error(Pattern.java:1472)
    at java.util.regex.Pattern.closure(Pattern.java:2473)
    at java.util.regex.Pattern.sequence(Pattern.java:1597)
    at java.util.regex.Pattern.expr(Pattern.java:1489)
    at java.util.regex.Pattern.compile(Pattern.java:1257)
    at java.util.regex.Pattern.<init>(Pattern.java:1013)
    at java.util.regex.Pattern.compile(Pattern.java:760)
    at Control.main(Control.java:24)
    Please help me on this issue.
    Thanks&Regards
    Debi
    import java.util.regex.*;
    import java.io.*;
    public class Control {
    public static void main(String[] args)
    throws Exception {
    //Create a file object with the file name
    //in the argument:
    File fin = new File("fileName1");
    File fout = new File("fileName2");
    //Open and input and output stream
    FileInputStream fis =
    new FileInputStream(fin);
    FileOutputStream fos =
    new FileOutputStream(fout);
    BufferedReader in = new BufferedReader(
    new InputStreamReader(fis));
    BufferedWriter out = new BufferedWriter(
    new OutputStreamWriter(fos));
         // The pattern matches control characters
    Pattern p = Pattern.compile("{cntrl}");
    Matcher m = p.matcher("");
    String aLine = null;
    while((aLine = in.readLine()) != null) {
    m.reset(aLine);
    //Replaces control characters with an empty
    //string.
    String result = m.replaceAll("");
    out.write(result);
    out.newLine();
    in.close();
    out.close();

    Hi,
    I used the code below with the \p, but I didn't able to complie the file. It gave me an
    D:\Debi\datamigration>javac Control.java
    Control.java:24: illegal escape character
    Pattern p = Pattern.compile("\p{cntrl}");
    ^
    1 error
    Please help me on this issue.
    Thanks&Regards
    Debi
    // The pattern matches control characters
    Pattern p = Pattern.compile("\p{cntrl}");
    Matcher m = p.matcher("");
    String aLine = null;

  • Removing Non-numeric characters from Alpha-numeric string

    Hi,
    I have one column in which i have Alpha-numeric data like
    COLUMN X
    +91 (876) 098 6789
    1-567-987-7655
    so on.
    I want to remove Non-numeric characters from above (space,'(',')',+,........)
    i want to write something generic (suppose some function to which i pass the column)
    thanks in advance,
    Mandip

    This variation uses the like operators pattern recognition to remove non alphanumeric characters. It also
    keeps decimals.
    Code Snippet
    CREATE FUNCTION dbo.RemoveChars(@Str varchar(1000))
    RETURNS VARCHAR(1000)
    BEGIN
    declare @NewStr varchar(1000),
    @i int
    set @i = 1
    set @NewStr = ''
    while @i <= len(@str)
    begin
    --grab digits or (| in regex) decimal
    if substring(@str,@i,1) like '%[0-9|.]%'
    begin
    set @NewStr = @NewStr + substring(@str,@i,1)
    end
    else
    begin
    set @NewStr = @NewStr
    end
    set @i = @i + 1
    end
    RETURN Rtrim(Ltrim(@NewStr))
    END
    GO
    Code to validate:
    Code Snippet
    declare @t table(
    TestStr varchar(100)
    insert into @t values ('+91 (8.76) \098 6789');
    insert into @t values ('1-567-987-7655');
    select dbo.RemoveChars(TestStr)
    from @t

  • Removing non-numeric characters from string

    Hi there,
    I need to have the ability to remove non-numeric characters from a string and I do not know how to do this.
    Does any one know a way?
    Example:
    Present String: (02)-2345-4607
    Required String: 0223454607
    Thanks in advance

    Dear NickM
    Try this this will work...........
    create or replace function char2num(mstring in varchar2) return integer
    is
    -- Function to remove Special characters and alphebets from phone no. string field
    -- Author - Valid Bharde.(India-Mumbai)
    -- Date :- 20 Sept 2006.
    -- This Function will return numeric representation.
    -- The Folowing program is gifted to NickM with respect to his post on oracle site regarding Removing non-numeric characters from string on the said date
    mstatus number :=0;
    mnum number:=0;
    mrefstring varchar2(50);
    begin
    mnum := length(mstring);
    for x in 1..mnum loop
    if (ASCII(substr(upper(mstring),x,1)) >= 48 and ASCII(substr(upper(mstring),x,1)) <= 57) then
    mrefstring := mrefstring || substr(mstring,x,1);
    end if;
    end loop;
    return mrefstring;
    end;
    copy the above program and use it at function for example
    SQL> select char2num('(022)-453452781') from dual;
    CHAR2NUM('(022)-453452781')
    22453452781
    Chao!!!

  • Removing non printable characters from an excel file using powershell

    Hello,
    anyone know how to remove non printable characters from an excel file using powershell?
    thanks,
    jose.

    To add - Excel is a binary file.  It cannot be managed via external methods easily.  You can write a macro that can do this.  Post in the Excel forum and explain what you are seeing and get the MVPs there to show you how to use the macro facility
    to edit cells.  Outside of cell text "unprintable" characters are a normal part of Excel.
    ¯\_(ツ)_/¯

  • Removing non-printable characters

    Hi All,
    I was suppose to remove all non-printable characters, hence created below function. But in trouble for some rows in table.
    function ar1(i_value in varchar2)
    return varchar2
    as
           pattern varchar2(1000) := '][';
           l_strVal varchar2(1000);
    begin
           for i in 32 .. 126 loop
              pattern := pattern || case when chr(i) = '''' then ''''''
                                         when chr(i) in ('[', ']') then null
                                         else chr(i)
                                    end;
           end loop;
              l_strVal := regexp_replace(i_value, '([' || pattern || '])|.', '\1', 1, 0, 'n');
    return l_strVal;
    end;
    /Could anyone please help me, is this right way to do it.
    Problem is occurring for one row as shown below.
    SQL> select num, ar1(author) author1, author from doc where doc_num =37;
       NUM
    AUTHOR1
    AUTHOR
      15098137
    OM LESRAVI{|~
    OM LES
    RAVIIts removing non-printable characters but not sure how these {|~ are included in the resultant.
    Would be great if anyone can help me.
    Edited by: YasserRACDBA on Nov 9, 2010 3:53 PM

    Thanks....but even your method is giving worng result as shown below.
    SQL> select regexp_replace(author,'[[:cntrl:]]')
      2  from doc where doc_num =15098137;
    REGEXP_REPLACE(AUTHOR,'[[:CNTRL:]]')
    OM LESRAVI{|~Is there any clue please...how come those {|~ are there??                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Removing Space Between Web Parts causes Horizontal Bar in Modals

    Hello all,
    I used the following to remove space between Web Parts, but am now getting a horizontal bar in my modals. Please assist:
    http://www.ashokraja.me/tips/How-To-Remove-Extra-Space-Around-the-Web-Part-In-SharePoint-2013
    Thanks!
    Kelly
    Personal Blog: http://thebitsthatbyte.com

    I removed it using the following CSS, which aligns our spacing:
    Control spacing between Web Parts*/
    .ms-webpart-cell-vertical
    margin-top:
    0px;
    margin-bottom:
    0px;
    Personal Blog: http://thebitsthatbyte.com

  • Remove un recognized characters from a field of a table.

    Is there any way to remove un recognized characters from content of field in a table. Please help.
    Thx

    If you know the characters that you want removed, you may have success using the TRANSLATE function.
    The key here as stated in the SQL Language Reference is
    the extra characters at the end of from_string have no corresponding characters in to_string. If these extra characters appear in char, then they are removed from the return value.
    The other useful function to remove unwanted junk is REGEXP_REPLACE - but you must be on 10g or later for regular expression support. Translate is supported at least as far back as 8i, perhaps further.

  • Remove spacing between minimize mazimize close buttons.

    How remove spacing between minimize, maximize, close buttons. Problem is only in firefox, when hide menu bar.
    image: http://www.bildites.lv/images/jx5yixdwdam0b5clli3.jpg
    Icons should be like in my computer window.
    OS: Windows XP; SP3
    Theme: http://www.crystalxp.net/galerie/en.id.130.htm
    Firefox 4.0 Beta 10

    Has anyone found a solution for this yet? I've searched everywhere, but have found little mention of the problem, let alone a fix. I have the same conditions as the original poster: XP, 3rd party visual style, and problem disappears when enabling the menu bar. My Windows caption buttons appear exactly like the posted screenshot. I would imagine CSS could fix it. Thanks,
    Brandon

  • Removing unwanted control characters in exported text files

    I am currently evaluating Crystal Reports 2008 to determine applicability to our requirements. I need to export data files to continuous text to be read by other application software. I have successfully created the files but have what I believe to be page feed or end-of-page control characters (small rectangles) in the output. Can someone enlighten me as to how I can suppress or remove these control characters?

    In the export to text options enter 0 for the number of lines per page. This will produce an unpaginated text document without the page control markers.

Maybe you are looking for

  • Can't move messages between folders

    When trying to drag a message into a Public Folder setup for Spam, I receive the following error: "The IMAP command "UID COPY" (to Public Folders/GFI AntiSpam Folders/This is spam email) failed for the mailbox "INBOX" with server error: There is no r

  • How to confuse people with poorly thought out ideas.

    So I'm looking to upgrade my phone and I see, "you're eligible for a free upgrade." however there's a $30 fee for this "free upgrade." Nonsense! After choosing my plan details for this new phone. (There were actually no changes in my plan from old ph

  • How do I change Flash's Quicktime export dimensions?

    Hello all, This is my first post in the Adobe forums, so I hope this is being posted in the right place. I recently upgraded from Flash CS3 to Creative Cloud and am now I'm confused about where an important feature I used is located. In Flash CS3, I

  • Problems with cropping in Raw editor- Photoshop CS6. Help!

    When I use raw editor in Photoshop CS-6 and I wish to crop the image. When doing this the crop box is at a fixed aspect ratio. How to I change it so my crop box is unconstrained? Just make sure this is in raw editor not Photoshop. My photos were take

  • How do you add "VIP" list to mail?

    How do you create the "VIP" list in mail?