PatternSyntaxException: Dangling meta character '*' near index 0

Hi,
I am using DocumentFilter to control the input in a JtextField In accordance with model of a mask.
The mask can contain the following characters:
    //  # :  for  =---> NUMBER only
    //  ? :  for  =---> LETTER only
    //  A :  for  =---> LETTER end for NUMBER
    //  * :  for  =---> ANYTHING    I made a class that extends DocumentFilter and it look like this:
public class MydocumentFilter extends DocumentFilter {
public void insertString(...){
// do anything
    } // insertString()
public void remove(...)
// do anything
    } // remove()
@Override
    public void replace(
            DocumentFilter.FilterBypass fb,
            int offset, // posizione del cursore
            int length, // Length of text to delete (solo per sostituzioni...)
            String text,// testo da inserire
            AttributeSet attrs) throws BadLocationException {
// here are some controls that change the value of the text variable, and at last call the super class..:
        super.replace(fb, offset, length, text.replaceAll(text, replace), attrs);
    } // replace()
} // class  MydocumentFilterI have a problem when the user write wildcards (='*' OR '?').
Then I get the message:
Exception in thread "AWT-EventQueue-0" java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0.I know that '*' and “?” are is a metachars and for that I added this code before calling super.replace(...);
        if (text.compareTo("*") == 0){
            replace = "\\*";
        }but I don't get the expected result. I get -\*- instead then -*-
here the code of the program that I use to make tests:
* http://www.java2s.com/Tutorial/Java/0260__Swing-Event/CustomDocumentFilter.htm
* @author Owner
//public class IntegerRangeDocumentFilter extends DocumentFilter {
public class NavBean_documentFilter extends DocumentFilter {
    enum CharAcceptability_ENUM {
        valid, invalid, overrite
    String mask;
    public NavBean_documentFilter(String mask_) { // constructor
        mask = mask_;
    } // constructor
    @Override
    public void insertString(
            DocumentFilter.FilterBypass fb,
            int offset,
            String string,
            AttributeSet attr) throws BadLocationException {
        System.out.println("insert string" + string);
        System.out.println(offset);
        super.insertString(fb, offset, string, attr);
    } // insertString()
    @Override
    public void remove(DocumentFilter.FilterBypass fb, int offset, int length)
            throws BadLocationException {
        System.out.println("remove");
        super.remove(fb, offset, length);
    } // remove()
    public void replace(
            DocumentFilter.FilterBypass fb,
            int offset, // posizione del cursore
            int length, // Length of text to delete (solo per sostituzioni...)
            String text,// testo da inserire
            AttributeSet attrs) throws BadLocationException {
        boolean valid = true;
        if (offset > mask.length()) {
            return;
        if (text.length() != 1) {
            return;
        CharAcceptability_ENUM charAcceptability_ENUM = checkTheInput(text, offset);
        String replace = null;
        switch (charAcceptability_ENUM) {
            case invalid:
                replace = "";
                break;
            case valid:
                replace = text;
                break;
            case overrite:
                char cc = mask.charAt(offset);
                replace = String.valueOf(cc);
                break;
        // It is because * is used as a metacharacter to signify one or more
        // occurences of previous character.
        // So if i write M* then it will look for files MMMMMM..... !
        // Here you are using * as the only character so the compiler
        // is looking for the character to find multiple occurences of,
        // so it throws the exception.:)
        if (text.compareTo("*") == 0){
            replace = "\\*";
        text = replace;
        super.replace(fb, offset, length, text.replaceAll(text, replace), attrs);
//        super.replace(fb, offset, length, text, attrs);
    } // replace()
    private CharAcceptability_ENUM checkTheInput(String text, int cursorPosition) {
        if (cursorPosition >= mask.length()) {
            return CharAcceptability_ENUM.invalid;
        char mappedCharInTheMask = mask.charAt(cursorPosition); // qui erro
        char charToSet = text.charAt(0);
        System.out.println("carattere da mettere = " + charToSet + " ; carattere della maschera = " + mappedCharInTheMask);
        boolean placeHolderFree = mask.contains(String.valueOf(mappedCharInTheMask));
        if (!placeHolderFree) {
            return CharAcceptability_ENUM.invalid;
        CharAcceptability_ENUM charAcceptability_ENUM =
                CharAcceptability_ENUM.invalid;
        char holdPlace = mask.charAt(cursorPosition);
        switch (holdPlace) {
            case '*': // 
                charAcceptability_ENUM = CharAcceptability_ENUM.valid;
                break;
            case '#': // only numbers
                if ( Character.isDigit(charToSet)) {
                charAcceptability_ENUM = CharAcceptability_ENUM.valid;
                break;
            case '?': //only letters
                if (Character.isLetter(charToSet)){
                    charAcceptability_ENUM = CharAcceptability_ENUM.valid;
                break;
            case 'A': // letters and numbers
                if (Character.isLetterOrDigit(charToSet)){
                charAcceptability_ENUM = CharAcceptability_ENUM.valid;
                break;
                default:
                    charAcceptability_ENUM = CharAcceptability_ENUM.overrite;
        System.out.println("valore di charAcceptability_ENUM = " + charAcceptability_ENUM.toString());
        return charAcceptability_ENUM;
    } // checkTheInput()
} // class UsingDocumentFilter
class RangeSample {
    public static void main(String args[]) {
        JFrame frame = new JFrame("Range Example");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        // questo (in generale) e' quanto si deve fare per usare un filtro...
        JTextField textFieldOne = new JTextField();
        JLabel jLabMask = new JLabel();
        JPanel panel = new JPanel();
        String explanation1 = "      ---  use of wildCard: ---";
        String explanation2 = " #  :  is for  =---> only NUMBER ";
        String explanation3 = " ?  :  is for  =---> only LETTER ";
        String explanation4 = " A  :  is for  =---> LETTER end NUMBER";
        String explanation5 = " *  :  is for  =---> ANYTHING      ";
        JLabel jLabExplanat1 = new JLabel(explanation1);
        JLabel jLabExplanat2 = new JLabel(explanation2);
        JLabel jLabExplanat3 = new JLabel(explanation3);
        JLabel jLabExplanat4 = new JLabel(explanation4);
        JLabel jLabExplanat5 = new JLabel(explanation5);
        panel.setLayout(new GridLayout(5, 1));
        panel.add(jLabExplanat1);
        panel.add(jLabExplanat2);
        panel.add(jLabExplanat3);
        panel.add(jLabExplanat4);
        panel.add(jLabExplanat5);
        jLabExplanat1.setForeground(Color.green);
        jLabExplanat2.setForeground(Color.red);
        jLabExplanat3.setForeground(Color.red);
        jLabExplanat4.setForeground(Color.red);
        jLabExplanat5.setForeground(Color.red);
        jLabMask.setForeground(Color.blue);
        //AAA-##:***
        String mask = "##-A#A:#????  ***";
//        String mask = "***";
        Document textDocOne = textFieldOne.getDocument();
        NavBean_documentFilter filterOne = new NavBean_documentFilter(mask);
        ((AbstractDocument) textDocOne).setDocumentFilter(filterOne);
        String jLabelTxt = "mask to use :  " + filterOne.mask + "   ";
        jLabMask.setText(jLabelTxt);
        frame.setLayout(new GridLayout(3, 1));
        frame.add(panel);
        frame.add(jLabMask);
        frame.add(textFieldOne);
        frame.pack();
        frame.setLocation(300, 150);
        frame.setVisible(true);
    } // main()
} // class RangeSampleany advice shall be appreciated
thank you
regards
Angelo Moreschini

All that many lines for a regex question (where the error message already pointed to), which has nothing to do with Swing. An SSCCE looks different.
if (text.compareTo("*") == 0){
replace = "\\*";
text = replace;
super.replace(fb, offset, length, text.replaceAll(text, replace), attrs);You must keep the text, the regex and the replacement string apart:
String text= "A", regEx= "A", rep= "B";
//String text= "*", regEx="\\*", rep= "*";
text= text.replaceAll(regEx, rep);
System.out.println(text);And why don't you use a JFormattedTextField with a MaskFormatter which does all the job for you.

Similar Messages

  • Error java: "Dangling meta character '+' near index 0 + ^"

    Hi,
    I'm receiving a runtime error, when I was trying to run search engine (only when I insert a symbol "+" plus or "\" slash) in B2B (E-selling of CRM-ISA 5.0).
    This is the text error:
    <b>
    java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 0
    +
    ^
         at java.util.regex.Pattern.error(Pattern.java:1541)
         at java.util.regex.Pattern.sequence(Pattern.java:1658)
         at java.util.regex.Pattern.expr(Pattern.java:1558)
         at java.util.regex.Pattern.compile(Pattern.java:1291)
         at java.util.regex.Pattern.(Pattern.java:1047)
         at java.util.regex.Pattern.compile(Pattern.java:808)
         at com.sap.isa.catalog.uiclass.ProductsUI.getHighlightedResults(ProductsUI.java:487)
         at jsp_ProductsISA1173566617857._jspService(jsp_ProductsISA1173566617857.java:507)
         at com.sap.engine.services.servlets_jsp.server.jsp.JspBase.service(JspBase.java:112)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:544)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:186)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doWork(RequestDispatcherImpl.java:321)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:377)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         at com.sap.isa.core.RequestProcessor.processForwardConfig(RequestProcessor.java:267)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at com.sap.isa.core.RequestProcessor.process(RequestProcessor.java:391)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at com.sap.isa.core.ActionServlet.process(ActionServlet.java:243)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doWork(RequestDispatcherImpl.java:321)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:377)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         at com.sap.isa.core.RequestProcessor.processForwardConfig(RequestProcessor.java:267)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at com.sap.isa.core.RequestProcessor.process(RequestProcessor.java:391)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at com.sap.isa.core.ActionServlet.process(ActionServlet.java:243)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doWork(RequestDispatcherImpl.java:321)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:377)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         at com.sap.isa.core.RequestProcessor.processForwardConfig(RequestProcessor.java:267)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at com.sap.isa.core.RequestProcessor.process(RequestProcessor.java:391)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at com.sap.isa.core.ActionServlet.process(ActionServlet.java:243)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doWork(RequestDispatcherImpl.java:321)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:377)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         at com.sap.isa.core.RequestProcessor.processForwardConfig(RequestProcessor.java:267)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at com.sap.isa.core.RequestProcessor.process(RequestProcessor.java:391)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at com.sap.isa.core.ActionServlet.process(ActionServlet.java:243)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doWork(RequestDispatcherImpl.java:321)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:377)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         at com.sap.isa.core.RequestProcessor.processForwardConfig(RequestProcessor.java:267)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at com.sap.isa.core.RequestProcessor.process(RequestProcessor.java:391)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at com.sap.isa.core.ActionServlet.process(ActionServlet.java:243)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doWork(RequestDispatcherImpl.java:321)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:377)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         at com.sap.isa.core.RequestProcessor.processForwardConfig(RequestProcessor.java:267)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at com.sap.isa.core.RequestProcessor.process(RequestProcessor.java:391)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at com.sap.isa.core.ActionServlet.process(ActionServlet.java:243)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.runServlet(FilterChainImpl.java:117)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:62)
         at com.tealeaf.capture.LiteFilter.doFilter(Unknown Source)
         at com.sap.isa.isacore.TealeafFilter.doFilter(TealeafFilter.java:61)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:58)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:373)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)</b>
    Any help will be appreciated.
    Regards
    Mark

    split() takes a regular expression, not just simple text. The + symbol means something special. Try something like split("\\+TO\\+")

  • Dangling Meta Character*

    Hi
    I am getting following exception while executing this statement.can any body give anyt idea and how to fix this problem?
    String sbr="this is kdfdanth redd*t from fdgkanth";
    String bol=sbr.replaceAll("*"," ");
    System.out.println("********* " + bol);
    Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta
    character '*' near index 0
    ^
    at java.util.regex.Pattern.error(Unknown Source)
    at java.util.regex.Pattern.sequence(Unknown Source)
    at java.util.regex.Pattern.expr(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.util.regex.Pattern.<init>(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.lang.String.replaceAll(Unknown Source)
    at Max.main(Max.java:23)

    in regular expression , a* means a,aa,....,aaaaa...a
    u pass some other string other than wild characters like *,?.
    the string u want to replace has * at its first place . even though the string has * at some other position like java*sun*com. it will not replace
    * with ur specified string. it will treat a* and n* i.e a,aa,aa.. or n,nn,nn....

  • Dangling meta character exception

    Hi,
    we get this exception after a readAll query with conformResultsInUnitOfWork. The presence of the "+" in the text seems to confuse toplink.
    Is it a known bug or should we open a TAR?
    java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 0
    +20019G KRUEGER RENATE.*
    ^
    at java.util.regex.Pattern.error(Pattern.java:1528)
    at java.util.regex.Pattern.sequence(Pattern.java:1645)
    at java.util.regex.Pattern.expr(Pattern.java:1545)
    at java.util.regex.Pattern.compile(Pattern.java:1279)
    at java.util.regex.Pattern.<init>(Pattern.java:1035)
    at java.util.regex.Pattern.compile(Pattern.java:779)
    at java.util.regex.Pattern.matches(Pattern.java:865)
    at oracle.toplink.internal.helper.JDK14Platform.conformLike(JDK14Platform.java:51)
    at oracle.toplink.internal.helper.JavaPlatform.conformLike(JavaPlatform.java:57)
    at oracle.toplink.expressions.ExpressionOperator.doesRelationConform(ExpressionOperator.java:769)
    at oracle.toplink.internal.expressions.RelationExpression.doesConform(RelationExpression.java:133)
    at oracle.toplink.publicinterface.UnitOfWork.getAllFromNewObjects(UnitOfWork.java:1493)
    at oracle.toplink.queryframework.ReadAllQuery.conformResult(ReadAllQuery.java:332)
    at oracle.toplink.queryframework.ReadAllQuery.registerObjectInUnitOfWork(ReadAllQuery.java:684)
    at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2222)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1038)
    We use Toplink 9.0.4.4, jdk 1.4.

    This is a known bug. It will be fixed in TopLink 9.0.4.6.

  • PatternSyntaxException: Unclosed character class near index

    Hi,
    I want to replace in a string a expression like "^1:2" by "^(1/2)":
    For example, "V/Hz^1:2" would be converted to "V/Hz^(1/2)".
    I tried the following code:
    String oldExponent = "[^](\\d+):(\\d+)"; // e.g. ^1:2
    String newExponent = "^($1/$2)";         // e.g. ^(1/2)
    myString = myString.replaceAll(oldExponent, newExponent);but the following exception is thrown in the third line:
    java.util.regex.PatternSyntaxException: Unclosed character class near index 13
    [^](\d+):(\d+)
                 ^Any idea?
    Thanks in advance.

    Thank you, jverd, you are pretty right.
    Now I tried with
    "\\^(\\d+):(\\d+)"and it works.
    I tried to avoid ^ being interpreted as the beginning of the line, and didn't realize the interpretation inside the brackets.
    Escaping this character works well.

  • Unclosed character class near index 0

    Hi foks,
    I am tryin to remove few characters from a string with the help of replaceAll ( String, String ) method.
    But at the first replacement itself it gives error "Unclosed character class near index 0".
    what does this error mean? I dont have any ' [ ' character in that string. It used to be there, but now I am removing all the occuring of the ' [ ' char right at the creation of string.
    Thanks in advance.

    Hi,
    Here is the code.
    [ CODE ]
    public static String extract(String para)
    String definition = para.substring(para.indexOf("<ol>"),para.indexOf("</ol>"));
    StringBuffer meanings=new StringBuffer();
    StringReader reader = new StringReader(definition);
    StringWriter writer = new StringWriter();
    boolean append=false;
    int ch;
    try
    while((ch=reader.read()) != -1)
    if(ch=='<' || ch=='&')
    append = false;
    continue;
    else if(ch=='>' || ch==';')
    append = true;
    continue;
    if(append && ch != '[' && ch != ']')
    writer.write(ch);
    catch(IOException e)
    System.out.println("IOException:"+e.getMessage());
    catch(Exception e)
    System.out.println("IOException:"+e.getMessage());
    meanings=writer.getBuffer();
    String temp = meanings.toString();
    System.out.println("temp:"+temp);
    temp=temp.replaceAll("["," ");
    System.out.println("temp:"+temp);
    temp=temp.replaceAll(" "," ");
    System.out.println("temp:"+temp);
    return temp;
    [ /CODE ]

  • Unexpected internal error near index 1

    Hi,
    I am convering al l occurance of "\" into "/" in a string.
    private String format(){
            input="java\\software\\";
            System.out.println("Before formating, input:" + input);
            try{           
                input=input.replaceAll("\\", "/");
                System.out.println("After formating, Input:" + input);
            }catch(Exception e){
                System.out.println("Error in formatting:" + e.getMessage());
            return input;
        }And I am getting this Error:
    Unexpected internal error near index 1
    Any idea whats wrong with above code?

    If you want to replace two backslashes with asingle
    forward slash, then you need to specify the former
    (as a regular expression) as "\\\\"OH! Thanks. I got another way and its working.
    I am using
    s.replace('\\', '/'); insteadd of
    replaceAll
    Yes, that's definitely better in this case, since that API is simpler for single-char replacements. If you sometime need to replace strings though (back to the replaceAll) you'll need to be aware of how regular expressions are formed and how the backslash character plays a part in forming them.

  • MySQL to Oracle Migration Issue - Unknown character set index for field.

    Hi,
    Looking for help..!!!
    Migrating mySQL - version 4 database to Oracle 10g using oracle migration work bench. It went well until the last step. But, during the data migration, OMWB has given the following error:
    +++++++++++
    Unable to migrate data from source table gets.sales_order_01 to destination table gets_ora.sales_order_oracle10: gets_ora.sales_order_oracle10; Unknown character set index for filed "12596" received from ser.
    +++++++++++
    Log file shows:
    java.sql.SQLException: Unknown character set index for field '12596' received from server.
         at com.mysql.jdbc.Connection.getCharsetNameForIndex(Connection.java:1692)
         at com.mysql.jdbc.Field.<init>(Field.java:161)
         at com.mysql.jdbc.MysqlIO.unpackField(MysqlIO.java:510)
         at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:285)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1326)
         at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1225)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2225)
         at com.mysql.jdbc.Statement.executeQuery(Statement.java:1163)
         at oracle.mtg.migrationServer.LoadTableData._migrateTableData(LoadTableData.java:563)
         at oracle.mtg.migrationServer.LoadTableData.run(LoadTableData.java:326)
         at oracle.mtg.migration.WorkerThread.run(Worker.java:268)
    I appreciate your help in this regards.
    Regards,
    K

    Hi K,
    Whats the default character set of you MySQL and Oracle Databases.
    What version of JDBC driver are you using?
    Is there any unicode characters used in your data?
    Have you tried offline data move?
    Thanks
    Dermot.
    Message was edited by:
    dooneill

  • "Incompatible line delimiter near index"

    G’day
    I’m doing a search and replace of \t\r\n, replacing it with just \r\n.  CFB says to me "Incompatible line delimiter near index", in red, down the bottom of the Find/Replace dialogue.
    What does that mean?
    Also, if I click the Help icon next to the message, I just get "The context help for this user interface element could not be found".
    Adam

    You're trying to use \n instead of \r\n in the replace.
    I got it when I matched:
    \n\t*foo
    in order to match the whitespace formatting in my source code.  The fix for me was to use
    \r\n\t*foo instead.

  • Unknown character set index

    i migrate from mysql4.0 to oracle i captured the source model and tranlate it to oracle but some tables didn't populate with data it gave me this error (Unable to migrate data from source table maeva.client_payment_mode to destination table root.CLIENT_PAYMENT_MODE :
    Unknown character set index for field "12819" received from server)

    Barry,
    I'm having the same problem; I included the details you're asking about in this thread:
    Re: UNKNOWN CHARACTER SET INDEX FOR FIELD '560' RECEIVED FROM SERVER.
    Thanks,
    Matt.

  • Unknown initial character set index '48'

    Hello,
    I have installed today the Mysql connector/j and every time I try to connect to mysql I get the following error.
    "java.sql.SQLException: Unknown initial character set index '48' received from server. Initial client character set can be forced via the 'characterEncoding' property."
    The line that produces this error is the following:
    conn = DriverManager.getConnection (url, userName, password);
    I have read some solutions from other people faced the same error as me but nothing really helped me.
    I have changed the character-set-server = latin1 and the collation-server = latin1_swedish_ci lines of win.ini several times today but no luck.
    Anyone know what should I do to manage to connect to the database?

    just in case anybody else face the same problem as I did, the solution that worked for me is to install an older version of connector/j.
    I had the problem with mysql-connector-java-5.0.4 but with mysql-connector-java-3.1.14 everything is fine and I can now connect to my db.

  • Error Connecting to MySql (character set index '49')

    I downloaded the Oracle Sql Developer extensions and went to Tools / Preferences / Third Part and set the location for the Jar file.
    When I try and test the connection to the MySql database I get this error:
    An error was encountered performing the requested operation:
    Unknown initial charater set index '49' received from the server.
    Initial client character set can be forced via the 'characterEncoding' property.
    Vendor code 0
    My dba's used Sql developer to connect to the same MySql database fine. If I use MySql Workbench, I can connect. (I prefer Sql Developer, so I was hoping to get this connection to work.)
    I even tried going to MySql to get their Connection/J JDBC jar file; but the same results.
    Any suggestions?
    Thanks,
    Mike

    Are your colleagues using the same sqldev/JDBC versions? Which?
    Did you follow the guide on setting it up, and the driver from http://dev.mysql.com/downloads/connector/j/ ?
    K.

  • File Properties (Meta Data) and Indexing

    Meta Edit™
    Find what you need, when you need it.
    If you manage a large network or portal, chances are that there are thousands of documents floating around that are difficult to locate due to poor file property information.
    With MetaEdit™, it’s easy to gain the control you seek and create rich document repositories you can count on.
    At it’s core, MetaEdit™ is a simple and easy-to-use software solution that allows users to quickly search, index, modify and maintain the META properties of ALL your files, such as Author, Company Name, etc…
    It’s EASY! Simply set a base folder to scan, then let MetaEdit™ do the work of gathering all the related meta information for you to efficiently manage and edit.
    Why wait? Maximize the value of your information today.
    For more detailed information and a FREE demo, visit http://www.spheric.ca/MetaEdit.aspx

    File -> Library -> Import playlist and select the old .XML file.

  • File Properties (Meta Data) and Indexing for your Portal

    Meta Edit™
    Find what you need, when you need it.
    If you manage a large network or portal, chances are that there are thousands of documents floating around that are difficult to locate due to poor file property information.
    With MetaEdit™, it’s easy to gain the control you seek and create rich document repositories you can count on.
    At it’s core, MetaEdit™ is a simple and easy-to-use software solution that allows users to quickly search, index, modify and maintain the META properties of ALL your files, such as Author, Company Name, etc…
    It’s EASY! Simply set a base folder to scan, then let MetaEdit™ do the work of gathering all the related meta information for you to efficiently manage and edit.
    Why wait? Maximize the value of your information today.
    For more detailed information and a FREE demo, visit http://www.spheric.ca/MetaEdit.aspx

    Acath?
    (1) Why would you need to change the color in HTML when you can specify it in Catalyst (Artboard Size & Color)?
    (2) I think the question was about specifying an "Image"... you can't in Catalyst, but is there any plan for beta 3?
    (3) Can you put a tranparent Artboard in Catalyst and specify a background image in the HTML?
    Thanks
    Roger

  • AS2 Adapter Error

    Hi
    I need to send DATA from RFC to External partner I am using PI 7.4 AS2 (B2B)
    I am getting the below error in the As2 , I am using the below Module . please let me know what is causing the below issue
    localejbs/X12ConverterModule
    MP: exception caught with cause java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
    ^
    Thanks
    Jai

    Hi Jai,
    The error is because incorrect regular expression is specified for the file name in receiver channel.
    Please check your receiver channel configuration. also refer the below thread
    Getting error "xml:java.util.regex.patternsyntaxexception dangling meta character '*' near index 0" while converting EDIFACT to XML
    regards,
    harish

Maybe you are looking for