Regular Expression match for BOM char .

i am trying to match BOM char in file with regex but \\ufeff seem to be not working .
please suggest solution on this

This line               String srcStr = new String(b);will only produce the String you expect if the BOM bytes can be converted to characters under your default character encoding. They probably can't.
I use this class
public class BOMStripperInputStream extends PushbackInputStream
    public static final int[][] BOMS =
            0x00, 0x00, 0xFE, 0xFF
            0xFF, 0xFE, 0x00, 0x00
            0x2B, 0x2F, 0x76, 0x38
            0x2B, 0x2F, 0x76, 0x39
            0x2B, 0x2F, 0x76, 0x2B
            0x2B, 0x2F, 0x76, 0x2F
            0xDD, 0x73, 0x66, 0x73
            0xEF, 0xBB, 0xBF
            0x0E, 0xFE, 0xFF
            0xFB, 0xEE, 0x28
            0xFE, 0xFF
            0xFF, 0xFE
    static private int testForBOM(int[] bom, int[] bytes)
        for (int index = 0; index < bom.length; index++)
            if (bom[index] != bytes[index])
                return 0;
        return bom.length;
    public BOMStripperInputStream(InputStream is) throws IOException
        super(is, 4);
        final int[] bytes =
            read(), read(), read(), read()
        int count = 0;
        for (int[] bom : BOMS)
            count = testForBOM(bom, bytes);
            if (count != 0)
                break;
        for (int index = bytes.length - 1; index >= count; index--)
            if (bytes[index] != -1)
                unread(bytes[index]);
}to get rid of a BOM .

Similar Messages

  • Help in regular expression matching

    I have three expressions like
    1) [(y2009)(y2011)]
    2) [(y2008M5)(y2011M3)] or [(y2009M5)(y2010M12)]
    3) [(y2009M1d20)(y2011M12d31)]
    i want regular expression pattern for the above three expressions
    I am using :
    REGEXP_LIKE(timedomainexpression, '???[:digit:]{4}*[:digit:]{1,2}???[:digit:]{4}*[:digit:]{1,2}??', 'i');
    but its giving results for all above expressions while i want different expression for each.
    i hav used * after [:digit:]{4}, when i am using ? or . then its giving no results. Please help in this situation ASAP.
    Thanks

    I dont get your question Can you post your desired output? and also give some sample data.
    Please consider the following when you post a question.
    1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
    You can use the following query and do a copy past of the output.
    select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
    that are asked the answer is already there.
    3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
    I have the following table called sales
    with sales
    as
          select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
          union all
          select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
    select *
      from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
    For example in the above sales table, I want to know the total quantity and number of invoice for each product.
    The output should look like this
    Prod_id   sum_qty   count_inv
    1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
    6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
    Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
    use the {noformat}{noformat} tags.
    The usage of the tag is like this.
    <place your code here>\
    7. If you are posting a *Performance Related Question*. Please read
       {thread:id=501834} and {thread:id=863295}.
       Following those guide will be very helpful.
    8. Please keep in mind that this is a public forum. Here No question is URGENT.
       So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Get all groups from a regular expression match

    Please help me understand how to use Java regular expressions:
    I have an expression similar to this:
    {noformat}"([^X]+)(X[^X]*)+"{noformat}This should match stuff like "asaasaXdfdfdfXXsdsfd".
    How does one access all the matches for the second group (the second groups has a Kleene operator
    added so it is not really just one group --- but match.groupCount() is always 2)
    Here is roughly the code:
    {noformat}java.util.regex.Pattern pattern = {noformat}{noformat}java.util.regex.Pattern.compile({noformat}{noformat}"([^X]+)(X[^X]*)+",{noformat}{noformat}java.util.regex.Pattern.MULTILINE{noformat}{noformat});{noformat}{noformat}java.util.regex.Matcher matcher = pattern.matcher(text);{noformat}{noformat}matcher.find();{noformat}{noformat}int groupcount = matcher.groupCount();{noformat}
    Also, without matcher.find() I get an illegalStateException .. which I also get if I use matcher.matches() instead
    of matcher.find().
    I am obviously missing something here. There is always at least one "X" in the string so shouldn't that pattern always
    match the whole string? Since there are often multiple X, shouldnt I get a group for each occurrence of X, followed
    by 0 or more other characters?
    {noformat}But when I try to match everything by using "^([^X]+)(X[^X]*)+$" I get an "IllegalStateException: No match available" again.{noformat}
    What is the correct way to do this?
    Edited by: johann_p on May 16, 2008 10:39 AM

    I am sorry I messed this up. Here is a SSCCE:
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;
    class RegExp1 {
        public static void main(String[] args) {
          String testString = "first|aaaa | bbbb\n|cccc|ddddd";
          Pattern pattern = Pattern.compile("^([^|]+)(\\|[^|]*)+$");
          Matcher matcher = pattern.matcher(testString);
          matcher.find();
          int groupcount = matcher.groupCount();
          System.out.println("Found "+groupcount+" groups");
          System.out.println("Matcher: "+matcher);
          for (int i = 1; i <= groupcount; i++) {
            System.out.println("Match "+i+": "+testString.substring(matcher.start(i),matcher.end(i)));
    }I figured out a small bug in my first code that explains some of the exception oddities, but my principal question remains:
    how do I access all the matches that correspond to the second capturing group?
    In the example I would get "first" for Match 1 and "|ddddd" for Match 2, but how do I access all the matches??
    Thank you for your help!

  • Regular Expressions - matching a brace

    I am a bit of a begginner when it comes to regular expressions - but I am trying to replace all curly braces - {} in a string with normal brackets - ().
    This is how I'm trying to do it -
    //replace any curly braces with normal brackets
    Pattern p = Pattern.compile("{");
    Matcher m = p.matcher(value);
    value = m.replaceAll("(");
    However, I get an exception when my code is run: "java.util.regex.PatternSyntaxException: Illegal repetition {"
    Any idea how to replace a brace character? Also, is there an easy way to replace both the open brace - { and close brace - } characters in one expression?
    Regards,
    Jake

    ..Also, is there an easy way to replace both the open brace - {
    and close brace - } characters in one expression?
      // only for paired curly braces
      while (target.matches(".*\\{(.*)\\}.*")) {
        target = target.replaceAll("\\{(.*)\\}", "($1)");

  • Spliting a large string using regular expression which contain special char

    I have huge sting(xml) containing normal character a-z,A-Z and 0-9 as well as special char( <,>,?,&,',",;,/ etc.)
    I need to split this sting where it ends with </document>
    for e.g.
    Original String:
    <document>
    <item>sdf</item>
    <item><text>sd</text</item>
    </document>
    <document>hi</document>
    The above sting has to be splited in to two parts since it is having two document tag.
    Can any body help me to resolve this issue. I can use StringTokenizer,String split method or Regular expression api too.

    manas589 wrote:
    I used DOM and sax parser and got few exception. Again i don't have right to change xml. so i thought to go with RegularExpression or some other way where i can do my job.If the file actually comes in lines like what you posted, you should just be able to compare the contents of each line to see if it contains "</document>" or whatever you're looking for. I wouldn't use regex unless I needed another problem.
    I got excpetion like: Caused by: org.xml.sax.SAXParseException: The entity "nbsp" was referenced, but not declared.
         at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
         at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)So then it isn't even XML.
    Edit: sorry, I just realized why you're considering all of these heavy-duty ideas. It's just that you don't know how to break the string into lines. You do it like this:
    BufferedReader  br = new BufferedReader(new StringReader(theNotXMLString));

  • Regular expression: check for the presence of special characters.

    I have the following requirement:
    I need to check for the presence of the following characters in a keyword: @, #, > if any of these characters are present, then they need to be stripped off, before going further. Please let me know the regular expression to check for these characters.

    I am trying to extend the same logic for the following characters:
    .,‘“?!@#%^&*()-~<>[]{}\+=`©® . here is the code fragment:
    Pattern kValidator = Pattern.compile("[\\.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]");
    Matcher kMatcher = kValidator.matcher(keyWord);
    if (kMatcher.find(0)) {
    keyWord = keyWord.replaceAll("[.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]", " ");
    }I get the following error. This error is from the weblogic command window. I dont understand these special characters.
    Error:
    28 Oct 2008 12:27:48 | INFO  | SearchController   | Exception while fetching search results in controller:Unclosed character class near index
    39
    [\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                           ^
    java.util.regex.PatternSyntaxException: Unclosed character class near index 39
    [\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                           ^
            at java.util.regex.Pattern.error(Pattern.java:1650)
            at java.util.regex.Pattern.clazz(Pattern.java:2199)
            at java.util.regex.Pattern.sequence(Pattern.java:1727)
            at java.util.regex.Pattern.expr(Pattern.java:1687)
            at java.util.regex.Pattern.compile(Pattern.java:1397)
            at java.util.regex.Pattern.<init>(Pattern.java:1124)
            at java.util.regex.Pattern.compile(Pattern.java:817)

  • Uri regular expression matching

    Hi, for some reason I cannot get a uri to match the following regular expression check.
    <If $uri !~ '^/dir/\?somename=(.*)'>
    NameTrans fn="restart" uri="/shownomatch?uriwas=$uri"
    </If>
    <Else>
    NameTrans fn="restart" uri="/showamatch?value=$1"
    </Else>I can see in the page that is restarted to that it should match by printing out the uriwas parameter.
    An example uri that should match but doesn't is /dir/?somename=5f801297-a8f6-42a4-933d-660f2120cd0d
    Any thoughts? I've tried a few different valid regular expressions, but cannot get a match.

    Thank you all for the help.
    My main goal was to provide verification that a user has logged in and has the proper authority to access a directory/resource. What I believe I now have is a check to verify that the user has a required cookie and that the value in the cookie matches the parameter in $query.
    Below is what I now have in the server's obj.conf file. Let me know if you think there is something that I am missing.
    <If $uri =~ '^/ValidationApp/*'>
      <Client security="false">
        NameTrans fn="redirect" url-prefix="https://server.domain.edu"
      </Client>
    </If>
    <If $uri !~ '^/ValidationApp/*'>
      <Client security="true">
        NameTrans fn="redirect" url-prefix="http://server.domain.edu"
      </Client>
    </If>
    <If $uri =~ "/SomeDir/*">
      <If not defined $query or not defined $cookie{"$(lookup('cookiemap.conf','/SomeDir'))"} or $query !~ 'uuid=(.*)' or $& ^ $cookie{"$(lookup('cookiemap.conf','/SomeDir'))"}>
        NameTrans fn="restart" uri="/ValidationApp/CookieCheckServlet?loc=$uri&uid=$(uuid())&ReqInfo=$(lookup('cookiemap.conf','/SomeDir'))"
      </If>
    </If>
    <If $uri =~ "/AnotherDir/*">
      <If not defined $query or not defined $cookie{"$(lookup('cookiemap.conf','/AnotherDir'))"} or $query !~ 'uuid=(.*)' or $& ^ $cookie{"$(lookup('cookiemap.conf','/AnotherDir'))"}>
        NameTrans fn="restart" uri="/ValidationApp/CookieCheckServlet?loc=$uri&uid=$(uuid())&ReqInfo=$(lookup('cookiemap.conf','/AnotherDir'))"
      </If>
    </If>The servlet used in the restart checks to see if the required cookie exists (ReqInfo) and if the uuid value (uid) is set in the session. If so it forwards to the uri (loc). If not it forwards to a login form the checks the user ID/password. It adds the uid to the session, creates the cookie, and forwards back to the requested uri.
    The Client security checks are down to make sure the user uses HTTPS when entering their user ID/Password.

  • How about the statement of regular expression like for this

    I what to get varians String array by one regular express for the statement like:
    ${user} like play ${game} in ${date}
    I want to get String[] as {"user","game","date"} by one regex, by str.split(regex). I tried many times but always fail to get the result I expected. May it be possible to meet the destination?
    thanks in advance
    Frederick

    why StringBuffer was using here?So one could split the pattern into multiple lines. But it just occurred to me that one could just use string concatenation, which would look better. I don't know why I bothered to use StringBuffefer.
    e.g.:
    String pattern =
        "^" +           // the start of a string
        "(dog)|(cat)" + // match either "dog" or "cat" at the start of the line
        "\\s*" +        // match an arbitrary amount of whitespace
        "$";            // but don't allow anything other than whitespace after dog or cat
    Pattern p = Pattern.compile(pattern);
    Pattern p = Pattern.compile("^(dog)|(cat)\\s*$");> isn't this look more simpler and better?
    In this case, yes. I was looking for a way to make regexps more explicit, with whitespace and comments, for more complicated cases.
    But those double quotes and plus signs add ugliness of their own, so a regexp would have to be pretty complex before it would be an improvement.

  • Regular Expression Search for Case Statement in VBA

    Hi,
    I'm having trouble trying to use regular expressions in a case statement. I have a CSV spreadsheet of a server's netstat output and am trying to plot everything into Visio. I have been able to do that, however I'm not trying to expand this capability and
    resuse the same code for many different servers. 
    I have the mainServer variable set as a Variant and in my current example it is set as "INTPXY001" (internal proxy server 001). I have tried different regex statements for the potential to have INTPXY001 - INTPXY999, EXTPXY001 - EXTPXY999, and
    SVCPXY001 - SVCPXY999 in place of the Case "INTPXY001", but nothing I have tried seems to work.
    '========================================
    Set mainServer As Variant
    Set AppVisio = CreateObject("visio.application")
    AppVisio.Visible = True
    AppVisio.Documents.AddEx "", visMSDefault, 0
    AppVisio.Documents.OpenEx "server_u.vss", visOpenRO + visOpenDocked
    mainServer = ActiveSheet.Cells(1, 2) 'sets mainServer to INTPXY001
    With AppVisio.ActiveWindow.Page
    Select Case mainServer
    Case "INTPXY001"
    .Drop AppVisio.Documents.Item("SERVER_U.VSS").Masters.ItemU("Proxy server"), 2.25, 9.25
    Case Else
    .Drop AppVisio.Documents.Item("SERVER_U.VSS").Masters.Item(("Server"), 2.25, 9.25
    End Select
    End With
    '========================================

    You cannot declare variables As Variant in VBScript. All variables in VBScript are implicitly variants.
    If you are asking about VBA (Visual Basic for Applications), then you're not asking in the correct forum.
    -- Bill Stewart [Bill_Stewart]

  • Indexing on regular expression seach for dynamic pattern

    Hello All,
    Would it be possible to create any index for regular expression search (REGEXP_LIKE) for 'dynamic' pattern?
    If the pattern is static, then we can create FBI, but is there any way for dynamic patterns? Please advise.
    Regards,
    Hari

    Thanks Dom, I have never used Oracle Text. Would it be possible to provide some sample code for above requirement.
    Regards,
    Hari

  • How to use regular expression replace for this special characters?

    hi,
    I need to replace the below string, but i couldnt able to do if we use the special charaters '+', '$' . can anyone suggest a way to do this?
    select REGEXP_REPLACE('jan + feb 2008','jan + feb 2008', 'feb',1,0,'i') from dual
    anwers should be :- feb

    you should use escape character \.
    the regular expression will look like as follows:
    select REGEXP_REPLACE('jan + feb 2008','jan \+ feb 2008', 'feb',1,0,'i') from dual
    hope this is what you needed.
    cheers,
    Davide

  • Regular Expression Required for Checksum variable

    I am wanting to create a regular expression that extracts a variable checksum value (cs=) which is unique to a given server response string.
    The issue I am having is that a simple regex being name="cs" value="(.+?)" just does not work because there are 18 different checksum values being returned per session id/server response.
    So a simple regex just picks up any "cs" value and I guess gets confused since there are 18 different ones contained within the server response (all user related)
    What i need is a regex to use say this value from the server response (JONHONEYMAN%40YAHOO.COM) or any other unique value which is contained within the string response from the server then extract the cs (Checksum) value from that string and make it variable :)
    Here is the server response string:-
    "fp=220:1200:2977638312763704:: NO::P1200_EMAIL_ADDRESS,P1200_ORGANISATION_NAME,P1200_UCRN,P1200_ORG_ID,P1200_CALLING_PAGE:JONHONEYMAN%40YAHOO.COM%2C john%20Honeyman%2C260%2C220%2C1190&cs=336788D01EC6E80B1877B3EE982E8B2D8" >Select</td></tr
    can anyone help?
    Thanks

    You need an XML Parser.

  • Regular expression help for matching numbers

    Hi,
    I want a exact match of either 9 digits or 12 digits, my query should give "No Match Found" as the input value is actually 10 digit
    select case when regexp_like(regexp_replace( ' 123 4567 890', ' ' ), '^([0-9]{9})|([0-9]{12})$')
    then 'Match Found'
    else 'No Match Found'
    end as test
    from dual;
    Need help, as I must be doing something very basic thing, wrong.
    Regards,
    Ash

    Remove 2 brackets:
    SQL> select case when regexp_like(regexp_replace( ' 123 4567 890', ' ' ), '^([0-9]{9}|[0-9]{12})$')
      2  then 'Match Found'
      3  else 'No Match Found'
      4  end as test
      5  from dual;
    TEST
    No Match Found
    SQL> select case when regexp_like(regexp_replace( ' 123 4567 89', ' ' ), '^([0-9]{9}|[0-9]{12})$')
      2  then 'Match Found'
      3  else 'No Match Found'
      4  end as test
      5  from dual;
    TEST
    Match Found
    SQL>

  • Regular Expression Fails for Large Inputs

    I've got a problem on mu RegEx
    This is happenning for only when I input large files to it.
    My code is shown brlow...
    public static boolean isComment(String line) {
    Pattern pattern = Pattern.compile("((?:/\\*(?:--^*|(?:\\*+--*/--^--))*\\*+/)|(?:--.*))", Pattern.CASE_INSENSITIVE);
    Matcher matcher = pattern.matcher(line);
    return matcher.find();
    public static boolean isNewLine(String line) {
    Pattern pattern = Pattern.compile("^[\\s\n]+$", Pattern.CASE_INSENSITIVE);
    Matcher matcher = pattern.matcher(line);
    return matcher.find();
    public static boolean isKeyWord(String line) {
    Pattern pattern = Pattern.compile("^[ \t\n]*(DECLARE|PACKAGE|TRIGGER|PROCEDURE|TYPE|CREATE|ALTER)", Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^return matcher.find();^
    ^}^
    ^public static String isCTExists(String regEx, String line) {^
    ^Pattern pattern = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^String s = line;^
    ^while (matcher.find()) {^
    ^s = matcher.replaceAll(replaceCTStr(matcher.group()));^
    ^}^
    ^if (s.equals(""))^
    ^return line;^
    ^else^
    ^return s;^
    ^}^
    ^public static String replaceCTStr(String line) {^
    ^Pattern pattern = Pattern.compile("\\)", Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^return matcher.replaceFirst("\\)\n/");^
    ^}^
    ^public static String isExists(String regEx, String line) {^
    ^Pattern pattern = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^String s = line;^
    ^while (matcher.find()) {^
    ^s = matcher.replaceAll(replaceStr(matcher.group()));^
    ^}^
    ^if (s.equals(""))^
    ^return line;^
    ^else^
    ^return s;^
    ^}^
    ^public static String replaceStr(String line) {^
    ^Pattern pattern = Pattern.compile("END[ \t]*;", Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^return matcher.replaceFirst("END;\n/");^
    ^}^
    ^public static boolean isHaveEnding(String line) {^
    ^Pattern pattern = Pattern.compile("(END[ \t\"A-Za-z_]*;[ \t\n]*)$|([\\)]{1}[ \t\n]*)$", Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^return matcher.find();^
    ^}^
    ^public static String checkCTMid(String regEx, String line) {^
    ^Pattern pattern = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE);^
    ^Matcher matcher = pattern.matcher(line);^
    ^boolean notEnded = false;^
    ^String s = "";^
    ^String temp = "";^
    ^while (matcher.find()) {^
    ^if (matcher.group() != null) {^
    ^if (isComment(matcher.group())) {^
    ^s += matcher.group();^
    ^} else if (isNewLine(matcher.group())) // all the new line characters handled here...^
    ^{^
    ^s += matcher.group();^
    ^continue;^
    ^}^
    ^}^
    ^if (matcher.group(1) != null && !matcher.group(1).equals("")) {^
    ^if (notEnded && isKeyWord(matcher.group(1))) {^
    ^s += "\n/";^
    ^notEnded = false;^
    ^} else^
    ^notEnded = false;^
    ^temp = isCTExists("(\\)[ \n\t\r]*--;--^(?:DECLARE|PACKAGE|TRIGGER|PROCEDURE|TYPE|CREATE|ALTER))", matcher.group(1));
    temp = isExists("(END;[ \n\t\r]*[^/](?:DECLARE|PACKAGE|TRIGGER|PROCEDURE|TYPE|CREATE|ALTER))", temp);
    s += temp;+
    +if (isHaveEnding(matcher.group(1))) {+
    +notEnded = true;+
    +}+
    +}+
    +}+
    +return s;+
    +}+
    +public static void main(String[] args) {+
    +String str = readFile("test.txt");+
    +System.out.println("Read Compleate");+
    +String strWithoutComments = checkCTMid( "(?:/\\*(?:--^*--|(?:\\*+--^/*--))*\\*+/)|(?:--.*)|((?:--^/-++|/(?!\\*)|-(?!-))*+)" , str ); //ok^--
    --^String strWithoutbSlashMiddleEndForCT = isCTExists( "(\\)[ \t\n\r]*--;/--^--$)" , strWithoutComments);
    String strWithoutbSlashMiddleEnd = isExists( "(END;[ \t\n\r]*--^/--$)" , strWithoutbSlashMiddleEndForCT);
    System.out.println(strWithoutbSlashMiddleEnd);
    {code}
    This code is currently parse SQL statements and add '/' characters finding the missed places.
    When i give this 'test.txt' as a long file (with 10000 LOC) gives belov error.
    *Exception in thread "main" java.lang.StackOverflowError*
    * at java.lang.Character.codePointAt(Character.java:2335)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2873)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    * at java.util.regex.Pattern$Branch.match(Pattern.java:4530)*
    * at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)*
    * at java.util.regex.Pattern$Loop.match(Pattern.java:4697)*
    * at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)*
    * at java.util.regex.Pattern$BitClass.match(Pattern.java:2876)*
    This is not hapenning for small files.
    Can anyone help!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Let's see if I can get this to display as intended: {noformat}(?:/\*(?:[^*]|(?:\*+[^/*]))*\*+/)|(?:--.*)|((?:[^/-]++|/(?!\*)|-(?!-))*+){noformat} Okay, when I try that regex (in EditPad Pro, against the source code of this web page), I see this result: The second alternative, {noformat}(?:--.*){noformat} matches anything from a double hyphen to the end of that line, and the third alternative: {noformat}((?:[^/-]++|/(?!\*)|-(?!-))*+){noformat} matches everything else (up to the next double hyphen, that is). These pages happen to contain a lot of SGML comments, so there are plenty of double hyphens to match. In a large document with only a few double hyphens, it would be easy to blow the stack trying to find the next stopping point.
    What exactly is the isComment() method supposed to do? Are you trying to match a line that consists entirely of a comment, or just a line that contains a comment? And how exactly do you define a comment?

  • Regular Expression needed for a password validator

    Business Rules:
    Password must be at least 8 characters
    Contain at least 1 non alpha character and no spaces.
    Here is what I got so far:
      String regex = "(?=^.{8,}$)((?!.*\\s)(?=.*[^a-zA-Z])(?=.*[a-zA-Z0-9]))^.*$";
            String [] password = new String [7];
            password [0] = "H@ffman1";
            password [1] = "hoffman1";
            password [2] = "Hoffman1";
            password [3] = "Hoffman 1";
            password [4] = "hoffman 1";
            password [5] = "hoffmans";
            password [6] = "123456789";
            for(int i=0; i<password.length; i++){
                Pattern pattern = Pattern.compile(regex.trim());
                Matcher matcher = pattern.matcher(password);
    System.out.println(password[i] + " == " + matcher.matches());
    }Output:
    H@ffman1 == true
    hoffman1 == true
    Hoffman1 == true
    Hoffman 1 == false
    hoffman 1 == false
    hoffmans == true // (This is a problem)
    123456789 == true // (This is a problem)

    YoungWinston wrote:
    prometheuzz wrote:
    which is pretty much what our OldWinston suggested...Actually, I was thinking more along the lines of
    System.out.println( password.matches("^[^\\s]{8,}$")
    && password[i].matches("[^a-zA-Z]") );
    (I may have got the number of backslahes wrong; 'always forget that stuff).Ah, I see. But you probably meant:
    password.matches(".*[^a-zA-Z].*")and they're cryptic enough as it is :-).
    Cryptic? Nah...

Maybe you are looking for

  • 64 bit mode and some questions

    Happy New Year all, Just once I'd like to start up in 64 bit mode. I've tried to do it several times without success and I don't know what the problem is. Hardware, software? I'm running two 10.6.2 systems, one on 1 SSD 3 drive Raid 0 array, one on a

  • ADF calendar date cell  background color change

    Hi, I am new to jdeveloper / ADF. I coded per the below calender sample in my jdeveloper and it runs fine. http://www.oracle.com/technetwork/developer-tools/jdev/calendar-091799.html The current date cell shows in yellow color background. How/where c

  • Best format for "Share"?

    I am going to be using the "Share" function with Photoshop Elements to post pictures for my relatives to view. I know that the photos uploaded to the site will be formatted by the site for display. What I would like to do is format them myself before

  • Read uncommited against sql 2005?

    Hi Has anybody done a read uncommited against a database? Is there a setting on the Datastore to do so, or anywhere else? Or do I have to make my own SQL-Block with SET TRANSACTION ISOLATION LEVEL .... Thanks in advance Michael

  • Can I still use my computer during a backup with Carbon Copy Cloner?

    just as the title says