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

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?

  • How to validate string that contains special characters.

    Hi,
    I am new to Data Services.I took excel sheet as a data source .Now i have do some validation functions like vendorgroup should not contain special characters ,name cleansing operations etc.. So,please anyone help me redarding this.
    Thanks in advance

    Anonymous,
    No this is not a bug. Working with multi-select lists or any item which stores colon delimited values can be tricky to work with in APEX. There are a few work arounds for this. One is to replace the colons with something else like you described and then replace the colons on the landing page. Another solution is to send the primary key for that record and have an automatic row fetch or a computation pull the colon delimited value.
    Cheers,
    Tyson Jouglet

  • Why does text on certain portions of websites, usually when adjacent text contains special characters, become jumbled into seemingly random sets of characters that are not in any way jumbled when viewing the source of the webpage? How can I fix this?

    When viewing most text on most websites, it displays properly. However, there are two instances where text will either tend to, or consistently, become jumbled into a mess of seemingly random characters. Oddly enough, these seemingly random characters are not, in fact, random. The same weird character will be used to replace the same regular English text character consistently across the entire area that has been jumbled.
    The two instances where this tends to occur most often, or consistently in some cases, are, first, when a paragraph or particular section of formatted text contains special characters, such as Chinese or Japanese characters, or accented letters. When this happens, usually the paragraph that contains the special characters is completely jumbled, while the rest of the text on the page will have intermittent jumbling on a word or two. Most often, the word "the" is jumbled in this case.
    The second instance where this happens is when a website uses specially formatted text in some form or another. I, not being an expert at web development, am not sure what kind of formatting causes it, but I can provide consistent examples in lieu of my experience:
    - Example 1:
    [http://img408.imageshack.us/img408/9564/firefoxcharencodingissu.jpg]
    Example 1 shows a portion of a screen-shot of the website "Joystiq.com". Every single article title on the front page of this blog is consistently jumbled, while the text of the article itself remains untouched. Please note that when this jumbled text is highlighted, it is visible un-jumbled in the right-click menu as well as in the source code of the page. Other consistent instances can be found within many search fields on various websites. For instance, the search bar located at the top right of "Kotaku.com" consistently displays jumbled characters both on its default text of "Search" and on any text that is typed into the search box itself.
    - Example 2:
    [http://img822.imageshack.us/img822/9564/firefoxcharencodingissu.jpg]
    Example 2 shows both the jumbling of the paragraph containing the character "☆" as well as the subsequent peppering of the rest of the article's text with small jumbled words. Below this is the DOM Source of the selected text which shows how the text itself is being rendered properly within the site's source. Additionally, for convenience, I have edited on to the bottom of the image a small snippet of what the search bar on the same page looks like. Notice how the grayed-out text that normally would read "Search" is instead jumbled.
    This issue has been plaguing my browser for the past year or so, and I had hoped that it would go away with subsequent Firefox updates. It has not gone away.
    Thank you for reading! Please help!

    This issue can be caused by an old bitmap version of the Helvetica or Geneva font or (bitmap) fonts that Firefox can't display in that size.
    Firefox can't display some old bitmap fonts in a larger size and displays gibberish instead.
    You can test that by zooming out (View > Zoom > Zoom Out, Ctrl -) to make the text smaller.
    Uninstall (remove) all variants of that not working font to make Firefox use another font or see if you can find a True type version that doesn't show the problem.
    There have also been fonts with a Chinese name reported that identify themselves as Helvetica, so check that as well.
    Use this test to see if the Helvetica font is causing it (Copy & Paste the code in the location bar and press Enter):
    <pre><nowiki>data:text/html,
    Helvetica<br><font face="Helvetica" size="25">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</font><br>
    Helvetica Neue<br><font face="Helvetica Neue" size="25">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</font>
    </nowiki></pre>
    You should reset the network.http prefs that show user set on the about:config page.<br />
    Not all websites support http pipelining and if they do not then you can have issues with images or other problems.
    See also http://kb.mozillazine.org/Images_or_animations_do_not_load#First_steps

  • 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

  • How to find out whether the String contains chinese characters

    I need to check if the string contains chinese characters in Java. Does anyone know how to do it? thx.

    Since Java strings contain UNICODE code points, check the content against the relevant page here - http://www.unicode.org/charts/ .

  • 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

  • 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

  • Unable to call report from jsp - password contains special characters

    Hi
    I used the following url to call my oracle report from my JSP webpage but got the error mentioned below. It seems that this error occurs when i use the login id with password that contains special characters only. How can I overcome this problem?
    Any help appreciated. Thx.
    Regards,
    Siti
    URL used: -
    "http://pc-325:8889/reports/rwservlet?server=pc-325&report=prodeff80120i&P_JDBCPDS="+vlogin1+"&destype=cache&desformat=pdf&paramform=no&p_type="+p_type;
    Error encountered: -
    REP-163: Invalid value for keyword DESTYPE.
    Valid options are FILE, PRINTER, MAIL, INTEROFFICE, or CACHE.

    Hi Stefan,
    Many of the customers are located in hungary and they have created the userid using their keyboard. Hence for now I already have a userid with that hungarian characters, in the SAP system.
    Only I would request for the help on how to interface these characters in SAP Business connector to call RFC.
    Thanks,

  • 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>

  • Export Database With Password Containing Special Characters

    Hi,
    I'm doing a database export using the command:
    exp userid=user/pass@instance parfile=exp_parms.dat
    The problem is that the password contains special characters so the command fails with a syntax error. The command works perfectly fine when I run it without the password and just type it in when prompted, but I need to include the password in the command because I am running it in a batch file. I've tried using the escape character (\), but this results in a username-password mismatch.
    Is there some way of declaring a password containing special characters in the 'exp' command?
    ...Thanks in advanced!

    Hi,
    I'm using linux and this is how I did it.
    I created a user named ddg with a password ddg)ddg
    I did my expdp command like:
    expdp ddg/"ddg\)ddg" directory=dpump_dir dumpfile=ddg.dmp
    Put the password in double quotes and escape the funny character with a \
    Hope this helps.
    Dean

  • How to replace multiple occurences of space in a string to a single space?

    How to replace multiple occurences of space in a string to a single space?

    Hi,
    try this code.
    data : string1(50) type c,
              flag(1) type c,
              dummy(50) type c,
              i type i,
              len type i.
    string1 = 'HI  READ    THIS'.
    len = strlen( string1 ).
    do len times.
    if string1+i(1) = ' '.
    flag = 'X'.
    else.
    if flag = 'X'.
    concatenate dummy string1+i(1) into dummy separated by space.
    clear flag.
    else.
    concatenate dummy string1+i(1) into dummy.
    endif.
    endif.
    i = i + 1.
    enddo.
    write : / string1.
    write : / dummy.

  • Column name in a query contains special characters

    Hi folks,
    The column name in a query contains special characters. For example ~ or ^. The creator of the table put these column names under double quotation while creating the table. When I get the column names form the result set meta data object it returns without quotation. Is there any way to tell the jdbc driver so that it return those column names as it was created, I mean in double quotation.
    The help is urgent. I will appreciate any suggestions. Thanks �.
    [using oracle driver for 10g]
    Thanks
    Angelina

    Just because the column names were in quotations when the database was created doesn't mean that the quotes are actually part of the names. What's inside the quotes is what makes the column name in the database. If I created a column as "abcd" and put it in quotes just like that ("abcd"), it would go in the database as abcd since SQL would strip off the quotes.
    And there's your answer. Just put all column names in quotes whenever you need to talk to SQL. It will strip off the quotes and understand.
    I think SQL will also accept square brackets ([ and ]).

  • 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

  • Check special characters in a string

    Hi all
    I am using oracle 10g.......
    Need to know what should be the query to check whether a special character exists or not in a column value....used the following query like.....
    select count(*) into emp_no_count_special_char
    from dual
    where REGEXP_LIKE(insert_data_rec.emp_no , '[#!$^&*%./\|]$' )
    or REGEXP_LIKE(insert_data_rec.emp_no , '^[#!$^&*%./\|]' );
    This works fine in case a string starts or ends with a special character ,what if a string of special characters lies in between numeric digits.
    e.g: '100#$%7'
    Please help find a query that checks for the existence of sp. characters irrespective of their position in the column!!!
    Thanks
    Dave
    Edited by: Dave on Jun 6, 2012 5:17 AM
    Edited by: Dave on Jun 6, 2012 5:18 AM

    Hi Dave,
    example below:
    -- Check that at least one special character exists in the string
    SELECT COUNT (*)
      INTO emp_no_count_special_char
      FROM DUAL
    WHERE REGEXP_LIKE (insert_data_rec.emp_no, '[#!$^&*%./\|]');
    -- Check that no special characters exist in the string
    SELECT COUNT (*)
      INTO emp_no_count_special_char
      FROM DUAL
    WHERE NOT REGEXP_LIKE (insert_data_rec.emp_no, '[#!$^&*%./\|]');
    {code}
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Starting Enterprise Manager error

    Hello, I installed oracle client 11g Release 1 (11.1) on opensuse 10.3 Linux system and I don't have installed any other oracle applications on my system. Installation was successfully, I've tried some applications netca, sqlplus, sqldeveloper and wo

  • INVENTORY & ORDER MANAGEMENT Tables join conditions required

    Hi All, I have to create one view, it has to display item_number, item_description,quantity_in_warehouse and pendingquantity_in_salesorder. query is based on INVENTORY & ORDER MANAGEMENT Tables. i have written below query, it is not giving expected o

  • Reverting back to a previous quicktime?

    I currently have quicktime 7.4.3 and am having trouble exporting. After reading through some other posts people have identified that their quicktimes have outstriped their FCP's. The one thing in those posts that wasn't addressed was how to actually

  • Flash lite V flash mobile ?

    im hoping to create a game on a pda/mobile phone to do this do i need flash lite or can i create documents in flash mobile documents(in flash cs3) that will work. i know its a rathar retarted question, but im really confused! help appreciated, thanks

  • WRT160N issue. I'm about to blow my brains out.

    Ok, so let me give the backstory. We're using this router for a small business. We went to one of our locations. I'll refer to this location as location #9. Anyways, we went to #9 with intentions of installing a Sonicwall, which is a router/firewall.