REGEX AND SPECIAL CHARACTER

Hi guys, I have a problem!!!!
I am using the java.util.regex.*, when I try use the special character, for example ' \w ' I get a error
Pattern.compile("\w123\w");
The compiler return to me that the \w character is not a valide, the output error are:
"illegal escape character".
What I need do to put this character in my regular expression and don't get the error?!!?
Another question, I use the feloow code
Pattern p = Pattern.compile("isc");
Matcher matcher = p.matcher("Giscard");
if(matcher.matches())
   System.out.println("MATCH");
else
  System.out.println("NOT MATCH");  //The resul is always this, why the regex don't match with my name?Thanks one more time.
Giscard

1)
Pattern.compile("\\w123\\w");To input a single "\" in a Java program you must enter two "\\".
2) read the javadoc
matches()
Attempts to match the entire region against the pattern.
So "isc" only matches "isc", not "Giscard"
You need to use find()

Similar Messages

  • Import over network link fails when table and special character.

    I am trying to do an import over the network link. Below is the command I am using to do the import. In the parameter file the table name has "$" sign. Database is on AIX.
    impdp "'/ as sysdba'" PARFILE=par_aml_aud_import.txt LOGFILE=test.log
    PARFILE:
    JOB_NAME=MONTHLY_XYZ_IMPORT
    NETWORK_LINK=XYZ_IMPORT_LNK
    DIRECTORY=XYZ_AUD_IMPORT
    TABLE_EXISTS_ACTION=TRUNCATE
    REMAP_SCHEMA=XYZ:XYZ_AUDIT
    REMAP_TABLESPACE=XYZ_DATA:XYZ_AUDIT_DATA
    REMAP_TABLESPACE=XYZ_INDEX:XYZ_AUDIT_INDEX
    EXCLUDE=GRANT
    TABLES=XYZ.DR$ABC_EFG_CTC1$N, DR$MNO_PQR_CTC1$N
    I have tested this import with following options.
    on the command line TABLES=\"XYZ\".\"DR\$ABC_EFG_CTC1\$N\" ---- (IN THE PARFILE)
    on the command line TABLES=\"XYZ\".\"DR\$ABC_EFG_CTC1\$N\" ---- (WITHOUT USING PARFILE)
    Still my import fails with below error.
    ======================
    ORA-39166: Object ."DR$ABC_EFG_CTC1$N" was not found.
    ORA-39166: Object ."DR$MNO_PQR_CTC1$N" was not found.
    ORA-39166: Object XYZ was not found.
    ORA-31655: no data or metadata objects selected for job
    Job "SYS"."SYS_IMPORT_TABLE_01" completed with 3 error(s) at 07:46:30
    I had more than 20 tables to import. All the other tables get imported except these tables which have special character. I have confirmed that these tables exists in source database.
    Please advice.
    Thanks
    Shelly

    First hint: don't use as sysdba
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_import.htm#sthref243
    Instead, create a user with (no more than necessary) export and/or import rights
    user7414922 wrote:
    on the command line TABLES=\"XYZ\".\"DR\$ABC_EFG_CTC1\$N\" ---- (WITHOUT USING PARFILE)Try something like tables=xyz.table\$name
    or
    tables='xyz.table$name'
    TABLES=XYZ.DR$ABC_EFG_CTC1$N, DR$MNO_PQR_CTC1$NSecond table should probably have schema qualifier as well.

  • MII 12.0.4 - Problem MessageListener and special character (German) -

    Hey,
    we have the following Landscape:
    + ECC 6.0 with Unicode
    + MII 12.0.4
    Settings on the MessageListener Server:
    gwhost xxxxxxxxx 
    gwserv xxxxxxxxx 
    progid SAP_MII 
    trace   
    params   
    snc_myname   
    snc_qop   
    snc_lib   
    unicode 1 
    max_startup_delay
    Settings on the MessageListener Client:
    client yyy 
    user yyyyyyyy 
    alias_user   
    passwd   
    lang    de
    sysnr xx 
    ashost xxxxxxxx 
    mshost   
    gwhost xxxxxxxx 
    gwserv xxxxxxxxx 
    r3name   
    group   
    tpname SAP_MII 
    tphost   
    type   
    trace   
    codepage  
    abap_debug   
    use_sapgui   
    getsso2   
    mysapsso2   
    x509cert   
    lcheck   
    grt_data   
    use_guihost   
    use_guiserv   
    use_guiprogid   
    snc_mode   
    snc_partnername   
    snc_qop   
    snc_myname   
    snc_lib   
    dest   
    saplogon_id   
    extiddata   
    extidtype   
    idle_timeout   
    dsr
    Error-Description:
    When MII get a Message (RFC) from the ECC, all special character (German Umlaut) coming wrong.
    I tried with changing the Language, codepage... without any success. When I call the same Message
    (RFC) from the BLS through a JCO action block, then the result is with special character. I also tried
    this on a MII 12.0.5 installation without success... Did anybody had this problem one time?
    Kind Regards
    Pedro

    Pedro,
    we are working in an german environment with unicode, although I have set the Message Listener language to EN. I have found some material texts which came down with a MATMAS that contain german umlaute and which are shown correctly inside the database.
    I have also used a "normal" JCo block, no session. I guess it would make no difference using an IDoc or RFC.
    Have you seen the wrong characters, in the MII workbench or in a database where you store the contents?
    Michael

  • Change Password with changePasswordForSelf and Special character

    Hi,
    I was trying to use the OIM (9.1.1.0) API to change the password using:
    userIntf.changePasswordForSelf(oldPassword, newPassword, confirmNewPassword);
    This works when I use some standard password.
    The issue appears when I try to enter certain special character: e.g: < or >
    The error returned is :
    <Error (class Thor.API.Exceptions.IllegalInputException): Thor.API.Exceptions.IllegalInputException>
    Exception is: Thor.API.Exceptions.IllegalInputException
    I reckon this is done to prevent injections.
    I didn't see any restriction in any of Oracle documentation and was wondering if you can help me understanding:
    - if you have observed the same issues before
    - which character are affected by this
    - if there is a work around to allow these character
    Thank you.

    That's because the special characters you are using are the scripting tags and it confuses itself with the OIM scripting process, for instance JSP's etc.
    So I would recommend not to do it and have your policies in place which restricts end-user to have a password with such special characters. I did not tried that but you can possibly do that.

  • Htp.p() and special character

    I am trying to use PL/SQL procedure to present my customized item.
    If user type in secial character, e.g. single quote ', in an attribute, I got this error on the page:
    Error 30584: DBMS_SQL has raised an unhandled exception. ORA-06550: line 1, column 327: PLS-00103: Encountered the symbol "03" when expecting one of the following: . ( ) , * @ % & = - + < / > at in is mod not rem <> or != or ~= >= <= <> and or like between ||
    Is there a procedure I can call to encode the special character? I tried htp.ps() and htf.escape_sc(), however they are not dealing with single quote.
    thanks

    I am using a custom item type to display news and annoucements for my intranet.
    The custom item type has an associated procedure that renders it on the front page of my intranet.
    If the end users enter an apostrophe such as ' . in the title custom item type or the body of the custom item type, I get an error message on the page where the custom item type is displayed, such as
    Error 30584: DBMS_SQL has raised an unhandled exception.
    I tried changing the procedure that formats and displays the custom item type so it replaces the quote for example
    v_description := replace(v_description, '''','ampersand#8217;');
    note i am using the ampersand character and not the word so it posts correctly here, the variable is then used as below .
    <td>'||substr(v_description,1,400)||'..</td> .
    but it does not work.
    Is there anyway of trapping what the user is typing in before it gets put into the database and replacing it with a html special character.
    or is my plsql wrong.
    Any help appreciated.

  • Script and special character!!

    Hi ,
    while printing address using address and endaddress, i am getting special character > ( ><(><<)> ( ><(><<)> <(><<)> ) > <(><<)>  inserted between ort01 and ort02 field while printing city in the editor in se71 , everytime i remove it it appear again and again....
    anyone faced something similar ....
    Regards
    Gunjan

    Hi
    Check whether your system is Unicde enabled or not?
    Because in Unicode system there is a chance to get such type of Unwanted special characters.
    Reward points for useful Answers
    Regards
    Anji

  • A problem with regex and special characters

    Hello,
    I am using regex in my application but i have a problem with special characters. Here is the explanation of what i am doing:
    I have a certain piece of text that i want to parse and replace every occurrence of a given word with some sort of a tag which have the word found inside it.
    so that: go Going Go to gOschool by bus and to learn and to play GO Go
    and i need to replace the word "go" (case insensitive and only at word boundaries) should be:
    *<start>go<end> Going <start>Go<end> to gOschool by bus and to learn and to play <start>GO<end> <start>Go<end>*
    Consider the following code and call the method with the parameter"go?"
    The Matcher finds a weird match at the word "G?oing" with only the letter G !!!
    It also ignores the "?" in the pattern completely.
    Any clue of what is happening i would be very grateful...
    private static String replaceMatches(String strToFind)
            String resultArticle="";
            String article = " "+"go? G?oing Go? to gOschool by bus and to learn and to play GO? Go?*"+" ";
            strToFind = "\\b"+ strToFind +"\\b";
            String linkPart1= "<start>";
            String linkPart2 = "<end>";
            Pattern p = null;
            try{
                p=Pattern.compile(strToFind, Pattern.CASE_INSENSITIVE);
            Matcher m = p.matcher(article);
            String[] res = p.split(article);
            int i=0;
            //System.out.println("result of split: "+res.length );
            while(m.find())
                resultArticle+=(res[i]+" ");
                resultArticle+=linkPart1;
                resultArticle+=m.group().trim();
                resultArticle+=(linkPart2+" ");
                i++;
            if(i<res.length)
                resultArticle+=res;
    //System.out.println("result of match: " + i);
    System.out.println(article);
    //System.out.println(resultArticle.trim()+scripts);
    catch(PatternSyntaxException ex){}
    return resultArticle.trim();
    }Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    tarek.mamdouh wrote:
    because split will not work when trying to replace the first word if i don't append a space at the beginning.Split doesn't work anyway. And my question wasn't why do you add spaces (which you really don't need to do), but why do you do them with " " + "go" rather than just " go"
    replaceAll will replace all the occurrences in the text with only one word. without taking into consideration the case of the word i need to replace.No.
    >
    If i use replacaAll(article, strToFind) the output will be:
    <start>go?<end> G?oing <start>go?<end> to gOschool by bus and to learn and to play <start>go?<end> <start>go?<end>No. I showed you the actual output of an actual replaceAll.
    which is not what i want as i need to keep the case of the words i am replacingThe replaceAll I showed you does that.
    Please study the examples given and read the docs carefully rather than making claims based on inaccurate guesses.

  • SAX Parser and special character problem

    Hi,
    Could anyone help with the following problem?
    Background:
    1. Using a SAX Parser (Oracle Implementation) to read XML from a CLOB, convert this XML to another format to be inserted in the database.
    2. Due to performance issues we parse the input stream from the CLOB.
    3. For same reason, we are not using XSL.
    This is the problem we face:
    1. Values of some of the tags in the XML have special characters (Ex: &, <, >).
    2. While using the SAX Parser, the element handler function for the SAX Parser is called by the frame work with the value of these tags broken up with each of these characters being treated as a tag delimiter.
    Ex: <Description>SomeText_A & SomeText_B</Description>
    is treated as SomeText_A in first call to the handler; SomeText_B in the second call.
    The handler function does not get to see the "&" character.
    Thus, the final conversion is
    Say, <Description> is to be converted to <FreeText>
    we, get <FreeText>SomeText_A</FreeText>
    <FreeText>SomeText_B</FreeText>
    We tried using &; but it then breaks it up into SomeText_A, & and SomeText_B.
    How can we get the whole value for the <Description> tag in the characters() function in the SAXParser so that we can convert it to <FreeText>SomeText_A & SomeText_B</FreeText>.
    Thanks in advance..
    Chirdeep.

    We already tried that..looks like the line where I mentioned that it converted the entity referece characters to an ampersand..
    "We tried using <entity reference for &> but it then breaks it up into SomeText_A, & and SomeText_B."
    null

  • External Table, Handling Delimited and Special Character in file

    Hi ,
    I have created one external table with these option
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY ***************************************
    ACCESS PARAMETERS
    ( RECORDS DELIMITED BY NEWLINE
    SKIP 0
    FIELDS TERMINATED BY '|'
    OPTIONALLY ENCLOSED BY '"'
    MISSING FIELD VALUES ARE NULL                                          
    LOCATION
    ( 'test_feed.csv'
    Now problem is these are coming as valid.
    anupam|anupam2
    anupam"test|anupam"test2
    "anupam|test3"|test3
    anupam""""test5|test5
    anupam"|test7
    but these are not coming as valid
    "anupam"test4"|test4    --> Case when we have quotes in the filed but still have quotes in it. I guess in this case we can send the filed expect closing double quotes.
    "anupam|test6   --> In case field is starting with double quotes then it's failing
    "anupam"test8|test8"|test8 --> In case one filed contains both pipe ( |) and double quotes then we are sending it enclosed in double quotes. But thats failing the job.
    Can you suggest what is the best way to handle such scenario? ( One restriction though. The file is used by other system - Netezza as well, which can't take more than one character long delimited :'( )

    One approach is to define the external table a ONE column table (with single field on the file). This way each line will come in as a row in the external table. Of course you have to build "parsing logic" on top of that.
    DROP TABLE xtern_table;
    CREATE TABLE xtern_table
        c1 VARCHAR2(4000)
      organization external
        type ORACLE_LOADER DEFAULT directory xtern_data_dir
        ACCESS PARAMETERS (
            RECORDS DELIMITED BY NEWLINE
            FIELDS TERMINATED BY '~'   ---- <<<<<<<< Use a field terminator as a character that is not found in the file
            MISSING FIELD VALUES ARE NULL
            ( c1 CHAR(4000)
         ) location ('mycsv.csv')
    > desc xtern_table
    desc xtern_table
    Name Null Type          
    C1        VARCHAR2(4000)
    > column c1 format A40
    > select * from xtern_table
    C1                                    
    anupam|anupam2                          
    anupam"test|anupam"test2                
    "anupam|test3"|test3                    
    anupam""""test5|test5                   
    anupam"|test7                           
    "anupam"test4"|test4                    
    "anupam|test6                           
    "anupam"test8|test8"|test8              
    8 rows selected
    Ideally, it will be good t have an incoming source file with predictable format.
    Hope this helps.

  • UTL_HTTP with parameter and special character

    hello,
    i need your help to solve this issue.
    I try to open an utl_http request which calls a procedure with some parameters.
    i have to create an url like:
    http://myserver.de/pls/portal/coup.run_report?p_link=run_coup&p_report=coupon_doc_hot.rdf&p_number1='d1=2887745051191'&p_pevno1='p1=TTG00000013''&p_transno1='t1=5'&p_number2='d2=0'&p_pevno2='p2=0'&p_transno2='t2=0'&p_number3='d3=0'&p_pevno3='p3=0'&p_transno3='t3=0'&p_number4='d4=0'&p_pevno4='p4=0''&p_transno4='t4=0''&p_number5='d5=0''&p_pevno5='p5=0'&p_transno5='t5=0'&p_number6='d6=0'&p_pevno6='p6=0'&p_transno6='t6=0'&p_number7='d7=0'&p_pevno7='p7=0'&p_transno7='t7=0'&p_number8='d8=0'&p_pevno8='p8=0'&p_transno8='t8=0'&p_number9='d9=0'&p_pevno9='p9=0'&p_transno9='t9=0'&p_number10='d10=0'&p_pevno10='p10=0'&p_transno10='t10=0'&p_desformat=pdf&p_destype=file&p_desname=/ias/developer/coup_cache/U002345/report.pdf
    If I run the url directly in the browser, everything is working fine. But with utl_http, I only get a 404 error.
    i guess it's caused due to the 'd1=0' parameter, but I can't avoid them.
    url_string := 'http://myserver.de/pls/portal/coup.run_report?p_link='||trim(to_char(l_link))||'&'||'p_report='||trim(to_char(p_report))||'&'||
    'p_number1=''d1='||trim(to_char(p_doc1))||''''||'&'||'p_pevno1=''p1='||trim(to_char(p_pevno1))||''''||'&'||'p_transno1=''t1='||trim(to_char(p_transno1))||'''&'||
    'p_number2=''d2='||trim(to_char(p_doc2))||''''||'&'||'p_pevno2=''p2='||trim(to_char(p_pevno2))||''''||'&'||'p_transno2=''t2='||trim(to_char(p_transno2))||'''&'||
    'p_number3=''d3='||trim(to_char(p_doc3))||''''||'&'||'p_pevno3=''p3='||trim(to_char(p_pevno3))||''''||'&'||'p_transno3=''t3='||trim(to_char(p_transno3))||'''&'||
    'p_number4=''d4='||trim(to_char(p_doc4))||''''||'&'||'p_pevno4=''p4='||trim(to_char(p_pevno4))||''''||'&'||'p_transno4=''t4='||trim(to_char(p_transno4))||'''&'||
    'p_number5=''d5='||trim(to_char(p_doc5))||''''||'&'||'p_pevno5=''p5='||trim(to_char(p_pevno5))||''''||'&'||'p_transno5=''t5='||trim(to_char(p_transno5))||'''&'||
    'p_number6=''d6='||trim(to_char(p_doc6))||''''||'&'||'p_pevno6=''p6='||trim(to_char(p_pevno6))||''''||'&'||'p_transno6=''t6='||trim(to_char(p_transno6))||'''&'||
    'p_number7=''d7='||trim(to_char(p_doc7))||''''||'&'||'p_pevno7=''p7='||trim(to_char(p_pevno7))||''''||'&'||'p_transno7=''t7='||trim(to_char(p_transno7))||'''&'||
    'p_number8=''d8='||trim(to_char(p_doc8))||''''||'&'||'p_pevno8=''p8='||trim(to_char(p_pevno8))||''''||'&'||'p_transno8=''t8='||trim(to_char(p_transno8))||'''&'||
    'p_number9=''d9='||trim(to_char(p_doc9))||''''||'&'||'p_pevno9=''p9='||trim(to_char(p_pevno9))||''''||'&'||'p_transno9=''t9='||trim(to_char(p_transno9))||'''&'||
    'p_number10=''d10='||trim(to_char(p_doc10))||''''||'&'||'p_pevno10=''p10='||trim(to_char(p_pevno10))||''''||'&'||'p_transno10=''t10='||trim(to_char(p_transno10))||'''&'||
    'p_desformat=pdf'||'&'||'p_destype=file'||'&'||'p_desname=/ias/developer/coup_cache/'||trim(to_char(p_user))||'/'||trim(to_char(filename))||'.pdf';
    htp.p(url_string);
    req := UTL_HTTP.BEGIN_REQUEST(url_string);
    UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0');
    --code is running till here. But response fails.
    resp := UTL_HTTP.GET_RESPONSE(req);
    any hint?
    best regards

    That's because the special characters you are using are the scripting tags and it confuses itself with the OIM scripting process, for instance JSP's etc.
    So I would recommend not to do it and have your policies in place which restricts end-user to have a password with such special characters. I did not tried that but you can possibly do that.

  • XMLType and Special Character Conversion

    I'm looking for something to convert special characters like &amp to the actual & it represents.
    I can't seem to find a method using
    extract for an xmltype or xslprocessor.valueOf
    I'm sure its something simple, but I'm having trouble putting my finger on it. Can anyone point me in the right direction?
    Thanks

    Let me restate. When I use and XMLDom and the xslprocessor.valueOf function, "&amp" is converted to "&"
    when I use v_char2 := v_doc.extract('/LoanPkg/Property/PRPTY_STRT_NME/text()').GetStringval;
    It doesn't convert it.

  • PHP and Special Character UTF8

    Hello, some users copy and paste inside a textarea documents from windows application like Word.
    When the page get data the special characters aren't correctly show (stange signs) also the w3c validator can't be validate the page.
    I use php with mysql, I have try to use iconv and utf8_encoder commands but doesn't work fine.
    I need to substitute all special char with an array ?

    As a test try connecting using one of the other drivers, ODBC, OLE DB or Native Oracle drivers. If it works then look at the JDBC driver causing the problem.
    Try using your JDBC driver out side of CR and see if it works also to confirm it will work.
    Thank you
    Don

  • German Umlaut and special character

    I have a dynamic text field that I need to populate with
    German characters like ä, ë, ü, ö . . .I have
    done this hundreds of times with MX2004, but after installing Flash
    Professional CS3, it does not work?

    The kerberos 5 standard has not specified how to deal with non-ASCII principal names, so you'd better avoid them.
    BTW, how do you input the umlaut character into the login screen? Are you using a German keyboard? I don't know how to turn the input method there.

  • Abap Dataflow and special character

    Dear All
    On DS inside an ABAP DATAFLOW when In a text column there\ are special characters like "ò" or "°" or "è" the system provide the error:
    "A row delimiter was seen for row number <149> while processing column number <1> in file <E:/BO/Z_ave_kna1>. The row delimiter
    should be seen after <39> columns. Check the file for bad data, or redefine the input schema for the file by editing the file
    format in the UI."
    Db target is Sybase IQ.
    My environment is BO 4.0 sp9
    DS 4.1
    can you help on this? any hint will be appreciated.
    Thanks
    Simone

    Problem solved by changing "data transfert method" in RFC.
    Thanks
    Simone

  • XMLParser and Special Characters

    Hi,
    I'm trying to read in an XML Document from a stream (e.g. a file) using XMLParser. The document contains german text (i.e. lots of special characters like umlauts �, �, � and others).
    If I read this stream into a text string all these special characters are perfectly handled (i.e. � looks like an �, etc.).
    However, if I import the stream into an XMLParser.Document using ImportDocument the umlauts seem to be scrambled. If the imported document is without any changes exported again to a stream (using ExportDocument) the umlauts are not displayed correctly anymore.
    Example Stream:
    <?xml version="1.0" encoding="iso-8859-1" ?>
    <UserID>M�ller</UserID>
    If this stream is imported into an XMLParser.Document and then exported again it contains
    <UserID>M��ller</UserID>
    I'm using correct XML encoding iso-8859-1 which is for western european languages and I guess it should not be a Forte locale issue since simple string handling of the stream works fine.
    Thanks for any hints,
    Daniel

    Let's start at the basics. Right now you are quite limited by your database character set as US7ASCII. You need to migrate to something that will support Latin and Greek characters at least. Maybe EL8ISO8859P7, or UTF-8. Please look at documentation Scanner Utility, available for Oracle 8.1.6 and above to make sure migration is safe before doing any import/export. The title of paper is: Database Character Set Migration, at: http://technet.oracle.com/products/oracle8i/listing.htm#nls
    UTF-8 will give you more versatility in the languages that your customer supports now or in the future. There is some performance overhead using Unicode but how much depends? I would base a large part of the Unicode decision on how likely it would be that other languages would need to be supported in the future and special character support.
    The special characters that your customer would like to support may already exist in Unicode. IF they don't or you choose another character set then your customer will need to look at the National Language Support Guide, Appendix 'B' "Customizing Locale Data"
    Are you running Greek windows? Otherwise how will you enter Greek characters? If you are using Greek windows you probably need to set your client NLS_LANG to EL8MSWIN1253.
    On your Forms questions you might want to take a look at the following :
    1. Chapter 4 of "Oracle Forms Developer and Reports Developer Release 6i: Guidelines for Building
    Applications" discusses How to design MultiLingual Applications.
    http://otn.oracle.com/docs/products/forms/doc_index.htm

Maybe you are looking for