Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
I am using split() to tokenize a String separated with * following this format: name*lastName*ID*school*age % name*lastName*ID*school*age % name*lastName*ID*school*age I'm reading this from a file named "entrada.al" using this code: static void leer() { try { String ruta="entrada.al"; File myFile = new File (ruta); FileReader fileReader = new FileReader(myFile);...
I need to use a regular expression that contains all the \b characters except the dot, . Something like [\b&&[^.]] For example, in the following test string: "somewhere deep down in some org.argouml.swingext classes and" I want org.argouml.swingext string to match but org.argouml string not too match. (Using the Matcher.find() method) If I use: \b(package_name)>\b they both mat...
I need to write a regular expression that finds javascript files that match <anypath><slash>js<slash><anything>.js For example, it should work for both : c:\mysite\js\common.js (Windows) /var/www/mysite/js/common.js (UNIX) The problem is that the file separator in Windows is not being properly escaped : pattern = Pattern.compile( "^(.+?)" + File.sepa...
  /*
   * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Sun designates this
   * particular file as subject to the "Classpath" exception as provided
   * by Sun in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
  * You should have received a copy of the GNU General Public License version
  * 2 along with this work; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  * CA 95054 USA or visit www.sun.com if you need additional information or
  * have any questions.
  */
 
 package java.util.regex;
 
Unchecked exception thrown to indicate a syntax error in a regular-expression pattern.

Author(s):
unascribed
Since:
1.4
Spec:
JSR-51
 
 
 public class PatternSyntaxException
     extends IllegalArgumentException
 {
 
     private final String desc;
     private final String pattern;
     private final int index;

    
Constructs a new instance of this class.

Parameters:
desc A description of the error
regex The erroneous pattern
index The approximate index in the pattern of the error, or -1 if the index is not known
 
     public PatternSyntaxException(String descString regexint index) {
         this. = desc;
         this. = regex;
         this. = index;
     }

    
Retrieves the error index.

Returns:
The approximate index in the pattern of the error, or -1 if the index is not known
 
     public int getIndex() {
         return ;
     }

    
Retrieves the description of the error.

Returns:
The description of the error
 
     public String getDescription() {
         return ;
     }

    
Retrieves the erroneous regular-expression pattern.

Returns:
The erroneous pattern
 
     public String getPattern() {
         return ;
     }
 
     private static final String nl =
         java.security.AccessController
             .doPrivileged(new GetPropertyAction("line.separator"));

    
Returns a multi-line string containing the description of the syntax error and its index, the erroneous regular-expression pattern, and a visual indication of the error index within the pattern.

Returns:
The full detail message
    public String getMessage() {
        StringBuffer sb = new StringBuffer();
        sb.append();
        if ( >= 0) {
            sb.append(" near index ");
            sb.append();
        }
        sb.append();
        sb.append();
        if ( >= 0) {
            sb.append();
            for (int i = 0; i < i++) sb.append(' ');
            sb.append('^');
        }
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X