REGEXP_REPLACE removing leading and trailing quotes.

Hello guys,
I have an issue with my regular expression and I'm hoping that someone can help me with it?
Imagine the following sample_data:
{code}
WITH sample_data AS
SELECT '''[email protected]''' as e FROM dual UNION ALL
SELECT '''[email protected]' as e FROM dual UNION ALL
SELECT '[email protected]''' as e FROM dual UNION ALL
SELECT '''[email protected]''' as e FROM dual UNION ALL
SELECT '[email protected]''' as e FROM dual UNION ALL
SELECT '''[email protected]' as e FROM dual
SELECT e, REGEXP_REPLACE(e, '(^'')?(.*)(''$)', '\2')
  FROM sample_data;
{code}
I would like to remove all leading and trailing quotes from the address email. I did the previous regexp but it does not returns the correct result. I don't know why, but for some reasons, when my email does not ends with a quote, the leading quote is not removed.
Can anyone help me with this?
Thanks,

Cant you just trim it?
WITH sample_data AS
SELECT '''[email protected]'''      as e FROM dual UNION ALL
SELECT '''[email protected]'        as e FROM dual UNION ALL
SELECT '[email protected]'''        as e FROM dual UNION ALL
SELECT '''[email protected]''' as e FROM dual UNION ALL
SELECT '[email protected]'''   as e FROM dual UNION ALL
SELECT '''[email protected]'   as e FROM dual
SELECT e, rtrim(ltrim(e, ''''), '''') new_e
  FROM sample_data;

Similar Messages

  • Removing Leading And trailing Zeros

    Hi Guys ,
    Can You help me out in UDF for removing leading and Trailing zeros
    Ex :  0123.234000000
    And it must satisfy below conditions .
    1 ) If value as Null we need 0.0 in target
    2) if the value is 0.0 we need 0.0 in target
    Thanks in Advance

    One more option:
    Input will be "str" of type string.
    Execution type: single value.
    mapping:
    Input -> mapwithdefault(0.0)->UDF->output
    if( !str.equals("0.0"))
    char[] chars = str.toCharArray();
    for (int index=0; index < str.length();index++)
    if (chars[index] != '0')
    str =str.substring(index);
    break;
    int length,index1 ;
    char[] chars1 = str.toCharArray();
    length = str.length();
    index1 = length -1;
    for (int in1=index1-1; in1>0;in1--)
    if (chars1[in1] != '0')
    str=str.substring(0,in1+1);
    break;
    return str;
    else
    return "0.0";
    http://wiki.sdn.sap.com/wiki/display/Java/RemoveLeadingandTrailingZerosfroma+String

  • Removing leading and trailing delimiters from a String

    I need to remove leading and trailing delimiters from a String like if my string is 111,112, then it should get changed to 111,112.Any idea how to do this??

    for my suggestion:String s = "111,112,";
    int begin = 0;
    while (!Character.isLetterOrDigit(s.charAt(begin)))
         begin++;
    int end = s.length() - 1;
    while (!Character.isLetterOrDigit(s.charAt(end)))
         end--;
    String news = s.substring(begin, end + 1);Of course, you'll have to clean it up a bit.

  • Apex: Removing leading and trailing blanks

    Hi,
    when observing end users working with my little apex application I noticed the input of leading and trailing blanks in a report search field. What do you recommend for removing this undesired input?
    I tried an ltrim(rtrim(:p1_searchfield)) in the report SQL query - the result is fine.
    But I have not found a way to keep the higlighting of the search word in the result set. There is a "highlight" property in the report field attributes dialog. But it looks like there is no way to enter any trim funtion over there. So the highlighting of matches does not work if there is a leading or trailing blank.
    Any ideas?
    Thanks & Cu
    Walter

    Walter,
    I would use an "after submit" computation on :p1_searchfield
    trim(:p1_filter)This way you won't have to change your select statement and the highlight term.
    ~Dietmar.

  • Remove leading and trailing puncation

    What's the best way to remove leading/trailing puncation from a word? Trim is good for leading and trailing whitespace but can I do anything for leading and trailing punctuation. I need punctuation that's in the middle of a word.

    one way would be to create an array of characters that include all the common punctuation marks. Then, using an iterative loop, compare each char in the file with each char from the array. If a match is found, then the file char is punctuation.

  • Unix Flat File: Remove header and trailer and put in another file.

    Hi,
    I have Source Flat File placed on Unix Box with header and trailer.
    I want to remove Header and Trailer and put in some other file and Data in another file.
    I tried following command in unix its working.But not getting Header and Trailer in another file.
    sed '1d;$d' input_source.txt > output_data.txt
    also How will i use OS command for it in ODI.
    Guide me.
    Thanks
    Ashwini

    Hi Ashwini,
    You can run OS commands in a package using an ODI Tool: OdiOSCommand.
    It is also possible to execute OS commands in an ODI procedure using the Operating System or Jython technologies.
    There should be some articles about this on metalink (http://metalink.oracle.com).
    Thanks,
    Julien

  • Hex to binary removes leading or trailing 0's

    hi,
    i'm trying to get a hex to binary conversion.  i am using a hex string to number conversion with the setting at binary, but it is deleting my leading zeros.
    for example if i put in a 7 hex, i get 111 instead of 0111.  or if i put in a 0 hex, i get 0 intead of 0000.  i understand it is equally the same thing but the interface i am communicating with is expecting all digits.
    thanks,
    Attachments:
    hex2bin.vi ‏7 KB

    Hi lfoitek,
    choose binary display, set the number of bits to show and select "fill with zeros at left"!
    Message Edited by GerdW on 02-08-2008 04:50 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    hex2bin.vi ‏7 KB

  • Leading and trailing 0's in Address Book???

    I get a string of 0's after phone numbers in my address book.  I transferred my addres book from a Treo 650 to my AT&T Centro. It seems that there are random 0's in the data and I can's seem to get rid of them.
    Does anyone else have this issue???
    Tom
    Post relates to: Centro (AT&T)

    I just tried the trial of DbFixIt and it detected NO errors in Contacts and only fouund errors in my calendar.
    Other suggestions???
    Would really like to get rid of these zeros!
    Thanks,
    Tom
    Post relates to: Centro (AT&T)
    Post relates to: Centro (AT&T)

  • How to prohibit leading and traling whitespace in XML Schema

    I want to prohibit the use of leading and trailing whitespace in an element but besides that all other content is allowed.
    For examble <   word? > should give a validation error.
    I do not want to use
    <whiteSpace value="collapse"/>
    Because it doesn't give a validation error.
    Is it possible to make a pattern og in some other way solve my problem?
    Thanks in advance, Martin

    Here is an example schema snippet (not a complete schema!) that does what you want I think, using a regular expresssion pattern, allowing one or more non-white-space characters followed by an optional sequence of any character followed by one or more non-white-space characters:
    Code Snippet
            <xs:element name="foo" maxOccurs="unbounded">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:pattern value="\S+(.*\S+)*"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
    Here are some example elements with valid contents:
    Code Snippet
      <foo>a</foo>
      <foo>a b</foo>
      <foo>a b c d e f g</foo>
    And here some elements with invalid contents that validation would catch:
    Code Snippet
      <foo> a</foo>
      <foo>a </foo>

  • To remove leading zeroes and take directly from IDOC(Segment field) to file

    Hi SapAll.
    i have got a simple requirement in a idoc to file Interface.
    here in a sender Idoc there will be one segment with one field,the requirement is to remove leading zeroes and take directly the data from this field and map to one of the field in  reciever  file structure.
    i had used the formatnumber (under arithmatic functions)in PI 3.0 but now when iam using it in PI7.1 it was raising some jave exception error.
    it would be preferable if any body can give me the solution without user defined functions.
    regards.
    Varma.

    from your first post:
    i had used the formatnumber (under arithmatic functions)in PI 3.0 but now when iam using it in PI7.1 it was raising some jave exception error.
    use the same formatting that you used in 3.0 .... try with just a # in the FormatNum function.
    Regards,
    Abhishek.

  • Function mudule to remove leading zeros of curreny and decimal type field

    Hi Expers,
    can any body suggest me the function mudule to remove leading zeros of curreny and decimal type  fields.
    plz do reply as early as possible.
    Thanks .....
    sunil.

    Hi,
    Use this FM CNIF_CONVERT_CURRENCY2EXT
    Import parameters               Value
    I_CURRENCY                      USD
    I_AMOUNT                        00000001233
    I_DECIMALS                      2
    Export parameters               Value
    E_AMOUNT                                           1.233,0000
    Regards
    Shiva

  • Add and remove leading zeroes

    Hi all,
           Iam having a requirement where in a enduser enters the vendor number and after pressing enter key it should display the vendor num along with vendor name concatenated in the same field. But the end user is provided the facility that he may not enter the exact vendor number ( I mean if vendor number is for example 0000055,  the enduser may enter simply 55). The system should convert it with leading zeroes internally. And in display it should display removing leading zeroes.
    like     input:  55              output : 55 Vendor_Name
    my approach
    iam using conversion_exit_alpha_input    for adding leading zeroes       before select query ( to fetch the vendor name for vendor number the user supplies)
    before displaying the output after concatenation,
    iam using  conversion_exit_alpha_output.
    after execution,
    it is asking the exact vendor number .  But in the output, it is giving the vendor number along with vendor name by removing leading zeroes ( as expected).
    how to make the system accept the number without leading zeroes. please suggest me.
    tthanking you in advance
    regards
    Bikash

    Hi Bikash,
    Since you have to display the Vendor number concatenated along with the Vendor Name, why do you need to use the Alpha Exit Function Module. As you have the Vendor number without the zeros in the input field, you can store it in a temporary variable and then once the Vendor name is available you can concatenate it along with the number in the same field.
    If you need a code snippet, you can provide the Technical details of the fields of input. We can use the implicit ABAP    type casting feature to get the Vendor Number without any leading zeros.
    Hope this helps.
    Thanks,
    Samantak.

  • Removing \n and leading spaces with String.replaceAll()

    I am trying to format a large XML string that contains carriage returns and lines with leading spaces. Something like this (pseudo example)...
    s: "<a>
    ��<b>some text</b>
    ��<c>
    ����<d>more text</d>
    ��</c>
    </a>"When i am done, i want it to look like this...
    s: "<a><b>some text</b><c><d>more text</d></c></a>"I have tried using replaceAll() in this way....
      s = s.replaceAll("^\\s+","");// to remove leading spaces
      s = s.replaceAll("\\n","");// to remove carriage returnsHowever, I am not getting the results I expect. In fact, the entire string seems to simply turn into all whitespace....
    s: "                                           "My question is: Is there an easier way? (or at least a way that works?)

    try this:
    public String transformXML(String s) {
        s = s.replace("^\\s+", "");
        s = s.replace("\\s+$", "");
        s = s.replace("\\s+", " ");
        s = s.replace("\\s*<\\s*([^<>]*?)\\s*>\\s*", "<$1>");
        return s;
    }which would transform your example expression from:
    <a>
    <b>some text</b>
    <c>
    <d>more text</d>
    </c>
    </a>
    to probably what you want:
    <a><b>some text</b><c><d>more text</d></c></a>
    Hope this helps~
    Alex Lam S.L.

  • Pages '09 integrating straight and curly quotes within one file.

    I'm doing an edit in Pages and the document has a mix of straight and curly quotes. I can't seem to find a way to get them all the same. Find-and-replace turns some of the quotes backwards (as in 'em for them) Nothing in the archives addresses this.

    Look for patterns in search and replace.
    Search for a space + " to get the leading quote and " + space to get a trailing quote.
    Or get WordServices to fix all this.
    Peter

  • Report Builder: output to Excel removes leading zeros

    I'm trying to use the Report Builder to output a numeric
    field to EXCEL , but on numbers that start with zero EXCEL removes
    the leading zero's. ex. 00123 becomes 123.
    Is there something that I can put in the expression builder
    on the field to overcome this.
    I've tried concatonating a single quote on the front of the
    field but the single quote shows up on the output. I've tried this
    on both the SQL and on the expression builder.
    I've read on some of the posts where people have tried using
    'mso-number-format:"\@'" within a TD tag but I can't seem to get
    the syntax right inside the Expression Builder.
    Has anybody got any suggestions?

    Excel will remove leading zeros in a numeric field because it is treating the column as numeric. Putting a ' in front of the number forces Excel to treat the column as text.

Maybe you are looking for

  • Is is possible to access channels from a CAN database in labview with NI USB 8473s

    Hello, I would like to know whether is possible to access a CAN database, which is uploaded through MAX, in labview. More specifically, I have uploaded my CAN database in MAX and I want to have access to each specific channel in labview. i.e accordin

  • In Firefox 30, how can I disable the Web Developer console?

    I use a keyboard macro program. Its settings, however, are preempted by the Web Developer tools' shortcuts. Therefore, I either want to (a) totally disable the Web Developer console or (b) remove/reset the shortcuts used by it.

  • Vendor Rebate for Partial Settlement

    Hi gurus, I need your help, I am new with some part of the Rebate process and this is my case. I have a rebate agreement where the validity date is 01.01.2009 to 31.12.2009. We have many POs, GRs and IVs for the Vendor assigned to this agreement and

  • Undoing insignoficant edits

    Hi, I'm working with the undo/redo manager, and i've got an issue with significant edits. Basically, if I: 1) do say 10 edits. 2) hit undo 5 times. 3) create an insignificant edit (basically right now I'm using a text editor, so any changes to the cu

  • How could I install Oracle Linux 6.3.

    When I am going to install oracle Linux 6.3 in my machine after selecting the installation option(i.e "Install or Upgrading the existing system" or "Install system with basic video driver") nothing is appearing except a blank screen. Please help. My