Replace Special Characters in a string + XQUERY

Hi All,
I am using the following replace function to replace the special characters in my XQUERY.
*replace($string1, '[&"-*;-`!|:,¿/{}@#$%^*~()_+-]', ' ')*
Fortunately it is replacing all the special characters. But the only problem here is it is even replacing capitol letters in to spaces, which I don't want.
Please help me out!!

Hi
<<< What did u change >?> I dont see any change with the Regex ?  >>
if you observe in the modified function, he just removed (*) inside the replace funtion.
Thanks
Shankar AUNV

Similar Messages

  • Need help in replacing special characters in a string

    Hi,
    please let me know the best way to replace all the special characters in a string with space.
    other than alphabets and numbers
    with regards.
    sumanth.

    please let me know the best way to replace all the special characters in a string with space.
    other than alphabets and numbers
    >
    Sumanth Nag Kristam wrote:
    > actually i need to replace hexa decimal char 0X1A in a string.... that is 'substitue' as per the chart
    > any pointers....
    >
    > chk the link for the ASCII codes
    > http://www.techonthenet.com/ascii/chart.php
    But in Hexa decimal value there is no special characters?

  • Replace Special Characters in a String

    Let's say someone copies the folowing list and pastes it into a Javascript prompt box:
    302304
    305678
    245675
    How do I manipulate the string so it reads:
    302304 305678 245675
    In other words, how do I replace the manual line breaks in a string with spaces?
    Thanks!

    \r and \n are both \s characters.
    This is functionally equivalent to what you have...
    stringName = stringName.replace(/\s/g,' ');
    I highly recommend browsing this website (lots of useful info there):
    http://www.regular-expressions.info/
    Harbs

  • How to replace special characters in string.

    Hello,
    I want to replace special characters such as , or ; with any other character or " ".I find out there is no such function is java for this.There is only replace() but it accepts only chars.If anybody know how to do this?.
    Thanks,

    Hello,
    I want to replace special characters such as , or ;
    with any other character or " ".I find out there is no
    such function is java for this.There is only replace()
    but it accepts only chars.If anybody know how to do
    this?.
    Thanks,Can't you just do the following?
    public class Test
         public static void main(String[] args)
         String testString = "Hi, there?";
         System.out.println(testString.replace(',',' '));
    }

  • How to search special characters in a string

    Hi all,
    I want to search special characters in all string columns and all rows in the table.
    The table has about 5 string columns and about 5.000.000 rows. For each row and column, I have to search entries, which included special characters like ", !, ? or something else (f.ex. "Mama?Mia" or "!!!Hotel out of order!!!"). The problem, the character could stand at each position in the string.
    What's the best and most performance possibility to search such entries?? Is it possibility only by SQL; is there a special function for this?? Or must I use PL/SQL.
    Thanks for helping
    Dana

    HTH
    Laurent Schneider
    OCM DBA
    SQL> select * from z;
    S
    Mama?Mia
    a b c
    123
    SQL> select * from z where translate(s,'~ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz1234567890','~') is not null;
    S
    Mama?Mia
    SQL> select * from z where regexp_like(s, '[^[:alnum:][:space:]]');
    S
    Mama?Mia

  • Sample code to identify special characters in a string

    Hi,
    I need to identify special characters in a string.... could anybody send me some code please.......
    Thanks,
    Best regards,
    Karen

    data: str(100) type c.
    data: str_n type string.
    data: str_c type string.
    data: len type i.
    data: ofst type i.
    str = '#ABCD%'.
    len = strlen( str ).
    do.
      if ofst = len.
        exit.
      endif.
      if str+ofst(1) co sy-abcde.
        concatenate str_c str+ofst(1) into str_c.
      else.
        concatenate str_n str+ofst(1) into str_n.
      endif.
      ofst = ofst + 1.
    enddo.
    write:/ str.
    write:/ str_c.
    write:/ 'spacial chracter',20 str_n.
    Function module  <b>SF_SPECIALCHAR_DELETE</b> <b>DX_SEARCH_STRING</b>
    l_address1 = i_adrc-street.
    CHECK NOT L_ADDRESS1 IS INITIAL.
    len = STRLEN( l_address1 ).
    do len times.
    if not l_address1+l(1) ca
    'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '.
    if i_adrc-street+l(1) CO sy-abcde.
    elseif i_adrc-street+l(1) CO L_NUMCHAR.
    exit.
    endif.
    l = l + 1.
    enddo.
    data : spchar(40) type c value '~!@#$$%^&()?...'etc.
    data :gv_char .
    data:inp(20) type c.
    take the string length .
    len = strlen (i/p).
    do len times
    MOVE FNAME+T(1) TO GV_CHAR.
    IF gv_char CA spchar.
    MOVE fnameT(1) TO inp2T(1).
    ENDIF.
    T = T + 1.
    enddo.
    REPORT ZEX4 .
    PARAMETERS: fname LIKE rlgrap-filename .
    DATA: len TYPE i,
    T TYPE I VALUE 0,
    inp(20) TYPE C,
    inp1(20) type c,
    inp2(20) type c,
    inp3(20) type c.
    DATA :gv_char.
    data : spchar(20) type c value '#$%^&*()_+`~'.
    START-OF-SELECTION.
    CONDENSE fname.
    len = strlen( fname ).
    WRITE:/ len.
    DO len TIMES.
    MOVE FNAME+T(1) TO GV_CHAR.
    IF gv_char ca spchar.
    MOVE fnameT(1) TO inpT(1).
    ENDIF.
    T = T + 1.
    ENDDO.
    CONDENSE INP.
    write:/ 'Special Characters :', inp.
    Rewards if useful..........
    Minal

  • RegExp for excluding special characters in a string.

    Hi All,
    Im using Flex RegExpValidator. Can anyone suggest me the correct expression to validate this condition?....
    I have tried this expression :----- /^[^///\/</>/?/*&]+$/...But in this it is also negating the alphabets.Also I have tried with opposite condition that in the String we should have alphabets and the expression is:-- ([a-z]|[A-Z]|[0-9]|[ ]|[-]|[_])*..... Please can anyone help me on this.
    Thanks in advanced to all.
    Munira

    sorry but you are posting things back that do not make any sense
    what do you mean with the below comment?
    munira06 wrote:
    Yes you are correct ,but I have tried this with single special character
    say
    Re: RegExp for excluding special characters in a string.
    here is a sample app taken from the live docs
    using ^[a-zA-Z0-9 \-_]*$ as the regex accepts all characters from a-z, A-Z, 0-9 - [space] and_
    run the example tell me what regex you are using and what test strings fail when they should pass or pass when they should fail
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Simple example to demonstrate the RegExpValidator. -->
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Script>
            <![CDATA[
                import mx.events.ValidationResultEvent;
                import mx.validators.*;
                // Write the results to the
                private function handleResult(eventObj:ValidationResultEvent):void {
                    if (eventObj.type == ValidationResultEvent.VALID) {
                        // For valid events, the results Array contains
                        // RegExpValidationResult objects.
                        var xResult:RegExpValidationResult;
                        reResults.text = "";
                        for (var i:uint = 0; i < eventObj.results.length; i++) {
                            xResult = eventObj.results[i];
                            reResults.text=reResults.text + xResult.matchedIndex + " " + xResult.matchedString + "\n";
                    } else {
                        reResults.text = "";
            ]]>
        </fx:Script>
        <fx:Declarations>
            <mx:RegExpValidator id="regExpV"
                    source="{regex_text}" property="text"
                    flags="g" expression="{regex.text}"
                    valid="handleResult(event)"
                    invalid="handleResult(event)"
                    trigger="{myButton}"
                    triggerEvent="click"/>
        </fx:Declarations>
        <s:Panel title="RegExpValidator Example"
                width="75%" height="75%"
                horizontalCenter="0" verticalCenter="0">
            <s:VGroup left="10" right="10" top="10" bottom="10">
                <s:Label width="100%" text="Instructions:"/>
                <s:Label width="100%" text="1. Enter text to search. By default, enter  a string containing the letters ABC in sequence followed by any digit."/>
                <s:Label width="100%" text="2. Enter the regular expression. By default, enter ABC\d."/>
                <s:Label width="100%" text="3. Click the Button control to trigger the validation."/>
                <s:Label width="100%" text="4. The results show the index in the text where the matching pattern begins, and the matching pattern. "/>
                <mx:Form>
                    <mx:FormItem label="Enter text:">
                        <s:TextInput id="regex_text" text="xxxxABC4xxx" width="100%"/>
                    </mx:FormItem>
                    <mx:FormItem label="Enter regular expression:">
                        <s:TextInput id="regex" text="ABC\d" width="100%"/>
                    </mx:FormItem>
                    <mx:FormItem label="Results:">
                        <s:TextInput id="reResults" width="100%"/>
                    </mx:FormItem>
                    <mx:FormItem >
                        <s:Button id="myButton" label="Validate"/>
                    </mx:FormItem>
                </mx:Form>
            </s:VGroup>
        </s:Panel>
    </s:Application>

  • Vbscript to rename files and replace special characters

    Dear Exprt,
    would you please help to add addtional requirement for rename and replace special characters for file
    by the below script i can re name.
    strAnswer = InputBox("Please enter folder location to rename files:", _
        "File rename")
        strfilenm = InputBox("Enter name:", _
        "Rename Files")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Sub visitFolder(folderVar)
        For Each fileToRename In folderVar.Files
            fileToRename.Name = strfilenm & fileToRename.Name
        Next
        For Each folderToVisit In folderVar.SubFolders
            visitFolder(folderToVisit)
        Next
    End Sub
    If FSO.FolderExists(strAnswer) Then
        visitFolder(FSO.getFolder(strAnswer))
    End If
    [email protected]

    Thx would you please look below what wrong in its run  nothing happend no error
    strAnswer = InputBox("Please enter folder location to rename files:", _
        "Test")
        strfilenm = InputBox("Enter name:", _
        "Rename Files")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set regEx = New RegExp
    'Your pattern here
    Select Case tmpChar
    Case "&"
    changeTo = " and "
    Case "/"
    changeTo = "_"
    Case Else
    changeTo = " "
    End Select
    regEx.Pattern = tmpChar 
    Sub visitFolder(folderVar)
        For Each fileToRename In folderVar.Files
            fileToRename.Name = strfilenm & fileToRename.Name 
            fileToRename.Name = regEx.Replace(fileToRename.Name, tmpChar)
        Next
        For Each folderToVisit In folderVar.SubFolders
            visitFolder(folderToVisit)
        Next
    End Sub
    [email protected]

  • Replace all special characters in a String with underscore

    I have a String which contains some special characters even(!,$,@,*....).
    I need to replace all the special characters with _ in my String. I do have an idea of using String.replace() and analogous forms, but I would be thankful if anyone can suggest me of a better and an efficient way.
    regards,
    fun_one

    Kaj,
    Thx for your earnest reply. I did have a peep into the API on this method. But the regular expression that I need to use here was beyond my understanding. It did specify some regex that I put to use (something like myString("\D","_"), assuming that I need to replace all non-digit characters ), but it really did not help me getting the result.
    Would you spare some code for me reg. the usage of regular expressions in such a scenario?
    cheers,
    fun_one

  • Replace special characters in String

    Dear Guru ,
    Does SAP provide the standard function that can replace the special characters in String ?
    For example :
    I have one template string : " & & & & & output(s) have not been processed yet ! " and five parameters : "P1" , "P2" , "P3" , "P4" , "P5" .
    And i would like to apply all parameters into the string to replace the "&" character . Is it possibile ?
    My idea is sourcing from the Message String that in tcode : SE91 .
    Thanks .
    Best Regards,
    Carlos Zhang

    Hi Carlos,
    I think instead of a standard FM you can write a one line command to do this job.
    E.g. 
    constant: str1 type string value 'output(s) have not been processed yet ! '.
    data: var1 type c,
             var2 type c,
             var3 type c,
             var4 type c,
             str    type string.
    concatenate var1 var2 var3 var4 str1 into str separated by space.
    So str will have the final value.
    Thanks,
    Mainak

  • How to replace string containing special characters by another string

    Hi all,
    I have to Search for a pattern and replace it by a substitute pattern [Eg: Replace methodOrig (a,b) with  SessTime = getSessionParameter(time);  methodNew(a,b,SessTime) ] in files.
    i tried this using replace(),but it din't work since string1 contains special characters.
    can anyone help me asap.
    thanks in advance.

    Double-post: http://forum.java.sun.com/thread.jspa?threadID=599211&tstart=0

  • Use of special characters in Search String

    What is the use of special charaters like
    in the search string in the Find & Replace of ABAP editor ?
    I want to search for all strings starting with V which are followed by alphabets like
    VA
    VB...
    If I use V*, it also gives me results like
    V/R...
    Whether it is possible to specify such a condition?

    Hi,
    While giving ur search in FIND & REPLACE,
    use the match case or match whole word only..
    Then u will get search results only where the exact case of that variable is used..
    As per my knowledge there is no signification of special characters ,- : ; in the search string..
    Hope this helps...
    Cheers,
    Simha.

  • Replacing special characters from xml document/text inside element

    Hi
    Is there any way to replace the xml codes to special characters inside an entire xml document/ for a text in element.
    I want to get the xml codes to get replaced to respective special character(for any special character)
    Please see the sample xml xml element below
    <Details>Advance is applicable only for &lt; 1000. This is mentioned in Seller&apos;s document</Details>
    Thanks in advance .. any help will be highly appreciated.

    So, just to be sure I understand correctly, you want this :
    <Details>Advance is applicable only for &lt; 1000. This is mentioned in Seller&apos;s document</Details>
    to be converted to :
    <Details>Advance is applicable only for < 1000. This is mentioned in Seller's document</Details>
    If so, I'll say again : the resulting XML document will be invalid.
    Extensible Markup Language (XML) 1.0 (Fifth Edition)
    The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings " &amp; " and " &lt; " respectively. The right angle bracket (>) may be represented using the string " &gt; ", and MUST, for compatibility, be escaped using either " &gt; " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end of a CDATA section.
    Ask whoever "they" are why they would want to work with not wellformed XML.

  • PDS - XML format, unable to read special characters in a string.

    Hi All,
    I've been using XML files to create my report with Oracle9i's new featue of PDS.
    Now, I'm unable to read a file if it contains '&' or '<' in the string. In fact, the xml file itself not able to crate a xml page in the browser, if these special characters are present.
    Is there any way to solve this problem ?
    I can't tell the users to remove &, < from the description data. Is there any way to workaround for this ?
    Thanks in advance,
    Satya.

    Hi Rohit and Rajesh
    Thanks for your reply.
    In fact, my problem is like this:
    I'll get data in .txt file and save that as a .xml file in the network before calling Oracle report ,which gets data from the .xml.
    The contents are like this:
    <Comapy name> Ford Motors UK & Europe</Company name>
    <Department> HR & Pensions</Depatrment>
    <Salary>Grad4 < 25000 </Salary>
    As per XML entity character representation, I need to replace '&' with '&amp;' and '<' with '<lt;'
    I'm wondering is there any other way to solve this problem as it is difficult to replace '<' and '>' generically.
    Honestly, I couldn't understand what Mr. Rajesh was trying to tell.
    'for & use & ( with semicolon at the end)'
    'for < use <'
    'for > use >'
    Can you shed some light on this ?
    Many thanks
    Satya.

  • Replace multiple characters in a string

    Hi, I have some string fields that contain special characters such as ô and û and I want to replace them with ō and ū, and their upper case equivalents as well. How do I write a single formula that would find any of these characters in a string and replace them?
    Thanks,
    Will

    replace(replace(replace(replace(x,'ô','ō'),'û','ū'),'Ô','Ö'),'Û','Ü');
    where x is the string field.  I suggest using the unicodes rather than the actual character.  I do not think that I have the correct uppercase characters.  Please ensure that they are correct in your formula.

Maybe you are looking for

  • Text Entry Box - On losing focus?

    Hello fellow Captivators.  I'm being thick-headed, I guess, but I'm trying to figure out how I might use the new feature of Text Entry Boxes on the Advanced tab: I tried the setting as in the graphic, then when I preview, I click in the text entry bo

  • Stop/Play action script

    I have two scenes, one has an audio player that I have to put a stop action on, the other is an animation in the background I need to loop. How can I do that and play both scenes at the same time so the animation loops, and the audio only plays once

  • I cannot watch support-videos although I have already installed QuickTime

    I have got Windows 7 and I want to learn about ITunes because I have just ordered an IPot and next week I will get the new IPot. I find it a goot idea to watch the videos about the first steps with ITunes. Startin the video I was told to install Quic

  • P&L, Balance sheet( BPC apps)

    Hi friends, I'm want build BPC balance sheet application(i.e balance sheet is YTD based). Earlier i designed BPC P&L application(periodic based), it is working as per expectation.  My question, can i manage both(P&L, Balance sheet applications) in si

  • JDeveloper display issue.

    Hi. I'm new here, so I'm not sure whether this post is in the right section, and ask a moderator to move it accordingly in case it doesn't. I have a problem with the 1.5.5 version of JDeveloper, installed on a Win7 32bit system. First of all, when la