How to specify ");" as a regular expression in split method of String class

How to specify ");" as a regular expression in split method of String class using delimeters?

Sorry, you can't specify that by using delimiters. Mostly because this requirement makes no sense.
Do you rather need "\\);"?

Similar Messages

  • Regular Expression with split method

    Hi.
    I am trying to use split to split up a String
    eg "I am a boy"
    into words including the \"
    I have tried reading up the tutorial but no clue yet.
    Any idea how can I get [",I,am,a,boy,"] ?
    Thank you :)

    I tried reading up but didn't really understand some parts..
    Here's a sample of the codes I come out with so far...
    String data = "\"I don't Dat--No Boi? a boy?\".";
    String[] splitData = data.split("(?<=[\\p{P}])|\\s|--");
    this returns
    " ,I ,don' ,t ,Dat , ,No ,Boi? , a ,boy? ," ,.
    This helps me remove the white spaces but the ? stays and splits the don't into don and 't also, the ' a' has a space infront too.
    Where is my problem ?
    Is there ways I can split it into
    <",I,don't,Dat,No,Boi,?,a,boy,?,",.>
    Thanks

  • How to Validate this using Regular Expressions

    Hi All,
    I have following types of Mail IDs, Each is a String.
    It may be either of the Following:
    [email protected]
    or
    Ameer<[email protected]>
    Then How to validate using the Regular Expressions.

    use this regex.. might need to convert it from perl regex flavor:
    (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
    )+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
    \r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
    ?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
    \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
    31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
    ](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
    (?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
    (?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
    |(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
    ?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
    r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
    \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
    ?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
    )*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
    \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
    )(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
    )+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
    *:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+
    |\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r
    \n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:
    \r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t
    ]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031
    ]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](
    ?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?
    :(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?
    :\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?
    :(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?
    [ \t]))*"(?:(?:\r\n)?[ \t])*)*:(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\]
    \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|
    \\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>
    @,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"
    (?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t]
    )*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
    ".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?
    :[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[
    \]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-
    \031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(
    ?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;
    :\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([
    ^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\"
    .\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\
    ]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\
    [\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\
    r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
    \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]
    |\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \0
    00-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\
    .|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,
    ;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?
    :[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*
    (?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
    \[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[
    ^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]
    ]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)(?:,\s*(
    ?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
    ".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(
    ?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[
    \["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t
    ])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t
    ])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?
    :\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
    \Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
    [^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
    ]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
    ?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
    ()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
    ?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
    @,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
    \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
    ;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
    )*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
    ".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
    (?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
    \[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
    \r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
    "()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
    *))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
    +|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
    .(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
    |(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
    ?:\r\n)?[ \t])*))*)?;\s*)

  • How can we implement a regular expression in if condition?

    hi,
    could any body tell me how can we implement regular expression in if condition?
    if a page contains links with .html,.pdf,.img etc as href paths then i should only retrieve the links whose href path is .pdf .
    any idea
    thanks in advance

    Pasumarthi,
    Here is some VBA that should do the trick. This was created against the empirix homepage. www.empirix.com.
    Private Sub RSWVBAPage_afterPlay()
    Dim objReg As New RegExp
    Dim objMatch As Match
    Dim doc As String
    'Get the html
    RSWApp.GetHtml doc
    'set parameters for regular expression searching and matching
    With objReg
        'find all occurances
        .Global = True
        .IgnoreCase = True
        'regular expression pattern specified here
        .Pattern = "a href=(.+?)pdf"""
    End With
    'Loop through the matches and write them to the results log.
    For Each objMatch In objReg.execute(doc)
        RSWApp.WriteToLog objMatch.Value
    Next
    Set objReg = Nothing
    End Sub

  • How to fetch substring using regular expression

    Hi,
    I am new to using regular expression and would like to know some basic details of how to use them in Java.
    I have a String example= "http://www.google.com/foobar.html#*q*=database&aq=f&aqi=g10&fp=c9fe100d9e542c1e" and would like to get the value of "q" parameter (in bold) using regular expression in java.
    For the same example, when we tried using javascript:
    match = example.match("/^http:\/\/(?:(?!mail\.)[^\.]+?\.)?google\.[^\?#]+(?:.*[\?#&](?:as_q|q)=([^&]+))?/i}");
    document.write('
    ' + match);
    We are getting the output as: http://www.google.com/foobar.html#q=database,*database* where the bold text is the value of "q" parameter.
    In Java we are trying to get the value of the q parameter separately or atleast resembles the output given by JavaScript. Please help me resolving this issue.
    Regards
    Praveen

    BalusC wrote:
    Regex is a cumbersome solution for fixed patterns like URL's. String#substring() in combination with String#indexOf would most likely already suffice.I usually agree, although, in this case, finding the exact parameter might be difficult without a small regex, perhaps:
    "\\wq=\\s*"in conjunction with Pattern/Matcher, used similarly to an indexOf() to find the start of the parameter value.
    Winston

  • How to find sunstring with regular expression?

    How can I find a substring in a string with a regular expression?
    Example:
    I have a original string "<tr><th>RecordId: </th><td valign=middle>A4711</td></tr>"
    Now i want to extract the value "A4711" from this string with a regular expression. Everything except "A4711" is fixed, the id "A4711" itself is dynamic. How is it possible to get the substring "A4711" of the original string with a regular expression?

    i wrote a little method with the infos above to get such results:
         * Get all substrings of a string that matches a regular expression.
         * @param original String to inspect.
         * @param regExp Regular expression as search criteria.
         * @return All matches of <i>regExp</i> or null if one input parameter is null.
        public static String[] getSubstrings(String original, String regExp) {
            String[] result = null;
            if (original != null && regExp != null) {
                Pattern pattern = Pattern.compile(regExp);
                Matcher matcher = pattern.matcher(original);
                boolean matchFound = matcher.find();
                Vector matches = new Vector();
                while (matchFound) {
                    String match = matcher.group();        
                    matches.addElement(match);
                    matchFound = matcher.find();
                }//next match
                int count = matches.size();
                result = new String[count];
                for (int i = 0; i < count; i++) {
                    result[i] = (String) matches.elementAt(i);
                }//next match
            }//else: input unavailable
            return result;
        }//getSubstrings()

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

  • A regular expression to detect a blank string...

    Anyone know how to write a regular expression that will detect a blank string?
    I.e., in a webservice xsd I'm adding a restriction to stop the user specifying a blank string for an element in the webservice operation call.
    But I can't figure out a regular expression that will detect an entirely blank string but that will on the other hand allow the string to contain blank spaces in the text.
    So the restriction should not allow "" or " " to be specified but will allow "Joe Bloggs" to be specified.
    I tried [^ ]* but this wont allow "Joe Bloggs" to pass.
    Any ideas?
    Thanks,
    Ruairi.

    Hi ruairiw,
    there is a shortcut for the set of whitespace chars in Java. It is the Expression *\s* which is equal to *[ \t\n\f\r\u000b]*.
    With this expression you can test whether a String consists only of whitespace chars.
    Expamle:
    String regex = "\\s*"; // the slash needs to be escaped
    // same as String regex = "[ \t\n\f\r\u000b]";
    System.out.println("".matches(regex)); // true
    System.out.println("   ".matches(regex)); // true
    System.out.println("  \r\n\t ".matches(regex)); // true
    System.out.println("\n\nTom".matches(regex)); // false
    System.out.println("   Tom Smith".matches(regex)); // falseBesh Wishes
    esprimo

  • Using Regular Expressions to replace Quotes in Strings

    I am writing a program that generates Java files and there are Strings that are used that contain Quotes. I want to use regular expressions to replace " with \" when it is written to the file. The code I was trying to use was:
    String temp = "\"Hello\" i am a \"variable\"";
    temp = temp.replaceAll("\"","\\\\\"");
    however, this does not work and when i print out the code to the file the resulting code appears as:
    String someVar = ""Hello" i am a "variable"";
    and not as:
    String someVar = "\"Hello\" i am a \"variable\"";
    I am assumming my regular expression is wrong. If it is, could someone explain to me how to fix it so that it will work?
    Thanks in advance.

    Thanks, appearently I'm just doing something weird that I just need to look at a little bit harder.

  • Unique regular expression to check if a string contains letters and numbers

    Hi all,
    How can I verify if a string contains numbers AND letters using a regular expression only?
    I can do that with using 3 different expressions ([0-9],[a-z],[A-Z]) but is there a unique regular expression to do that?
    Thanks all

    Darin.K wrote:
    Missed the requirements:
    single regex:
    ^([[:alpha:]]+[[:digit:]]+|[[:digit:]]+[[:alpha:]])[[:alnum:]]*$
    You either have 1 or more digits followed by 1 or more letters or 1 or more letters followed by 1 or more digits. Once that is out of the way, the rest of the string must be all alphanumerics.  The ^ and $ make sure the whole string is included in the match.
    (I have not tested this at all, just typed it up hopefully I got all the brackets in the right place).
    I think you just made my point.  TWICE.  While the lex class would be much more readable as a ring.... I know all my brackets are in the correct places and don't need to hope.
    Jeff

  • Regular expression - get longest number from string

    I believe it is easy one but I can't get it.Lets say I have a string 'A1_1000' I want to substract the 1000 using regular expression. When I feed Match regular expression I get '1' which is not the longest number. I know other ways of doing that but I want clean solution in one step. Does anybody knows the right regular expression to accomplish that? Thanks!
    LV 2011, Win7
    Solved!
    Go to Solution.

    ceties wrote:
    This is the best solution I was able to come with. I am just wondering if there is "smoother way" without the cycle.
    Since multiple checks are required I would tend to beieve that we do have to loop through the possibilities. in this example
    I start check at offset "0" into the string for a number. Provided i find a number I check if it is longer that any previous number I found and if so save the new longer number in the shift register.
    Have fun!
    Ben
    Message Edited by Ben on 04-15-2009 09:23 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Find_Longest.PNG ‏33 KB

  • Cannot get regular expression to return true in String.matches()

    Hi,
    My String that I'm attempting to match a regular expression against is: value=='ORIG')
    My regular expression is: value=='ORIG'\\) The double backslashes are included as a delimiter for ')' which is a regular expression special character
    However, when I call the String.matches() method for this regular expression it returns false. Where am I going wrong?
    Thanks.

    The string doesn't contain what you think it contains, or you made a mistake in your implementation.
    public class Bar {
       public static void main(final String... args) {
          final String s = "value=='ORIG')";
          System.out.println(s.matches("value=='ORIG'\\)")); // Prints "true"
    }

  • How do I modify a regular expression?

    I am using the following expression: ('/^\p{L}+[-\'\p{L} ]+$/u') to verify that an input field has just got letters in it.
    The letters can be any letters represented in UTF-8.
    It works great (It was used by David Powers for his book Adobe Dreamweaver CS5 with PHP) except in one area.
    It will not allow the use of a single letter. It allows "H " but not "H".
    I need to allow for people who do not want to submit their full name, but just the initial letter instead.
    How do I change it so that it will allow a single letter as well as a whole word?
    Howard Walker

    For some reason, some of the pages on my site are missing the opening body tag. I need a regex that will search for the closing head tag and look to see if the opening body tag is on the line below it. If not, it should replace the closing head and empty line below with the closing head and opening body tag.
    Don't know the regex I'm afraid. Just another possible approach.
    Is the opening tag after the <body> tag the same on each page? e.g. <div>
    If so, replace
    </head>
    <div>
    with
    </head>
    <body>
    <div>

  • How to interpolatin in java regular expression

    Hello,
    I am having a problem regarding variable interpotaion in java regex.
    i am having a pattern file .
    This is one of my Pattern from pattern file
    (\{NP_PP_[0-9]+\}|\{NP_B_[0-9]+\}|\{NP_P_[0-9]+\}|\{NP_[0-9]+\})[^{}]*PHOSphorylatable amino[^{}]*(\{NP_PP_[0-9]+\}|\{NP_B_[0-9]+\}|\{NP_P_[0-9]+\}|\{NP_[0-9]+\}|\{NP_C_[0-9]+\}) on (\{NP_P_[0-9]+\}[^{}]+\{NP_P_[0-9]+\}|\{NP_B_[0-9]+\}[^{}]+\{NP_B_[0-9]+\}))(
    In which amino has a separate set of values ,defined in program.
    And i need to pass the value of amino from the program to the file during compilation. but it is getting compiled as a text..not as it's values defined in program.
    so help me out how i can pass the values of amino to the file.

    Hello,
    I am having a problem regarding variable interpotaion in java regex.
    i am having a pattern file .
    This is one of my Pattern from pattern file named 'ultimatepat'(check RuleFile = "/home/texsieve/sample/src/ultimatepat")
    ((\{NP_PP_[0-9]+\}|\{NP_B_[0-9]+\}|\{NP_P_[0-9]+\}|\{NP_[0-9]+\})[^{}]*PHOSphorylatable amino*+[^{}]*(\{NP_PP_[0-9]+\}|\{NP_B_[0-9]+\}|\{NP_P_[0-9]+\}|\{NP_[0-9]+\}|\{NP_C_[0-9]+\}) on (\{NP_P_[0-9]+\}[^{}]+\{NP_P_[0-9]+\}|\{NP_B_[0-9]+\}[^{}]+\{NP_B_[0-9]+\}))
    In which '_amino_' has a separate set of values ,defined in program.
    my program is::
    public class Ptmrules {
         public static void main(String[] args)
              try
                   String InputFile = "/home/texsieve/sample/src/gt_bm.newtyp";
                   String RuleFile = "/home/texsieve/sample/src/ultimatepat";
         String amino= "(valine|serine)";
         System.out.println("sites are"+amino);
                   BufferedReader rd1=new BufferedReader(new FileReader(InputFile));
              BufferedReader rd2=new BufferedReader(new FileReader(RuleFile));
              ArrayList<String> phosPatterns = new ArrayList<String>();
              String line1=null;
              String line2=null;
              String l1="phosphorylatable";
              while((line2=rd2.readLine())!=null)
                   phosPatterns.add(line2);
                   Pattern pat1 = Pattern.compile(line2);
                   System.out.println("PATTERN"+pat1);
              int len=phosPatterns.size();
              System.out.println("Total Patterns compiled::"+len);
              while((line1=rd1.readLine())!=null)
                        Pattern pat=Pattern.compile(l1);
                        Matcher mat=pat.matcher(line1);
                        while(mat.find())
                             line1=line1.replaceFirst("phosphorylatable","PHOSphorylatable");
                             for(int i=0;i<len;i++)
                                  String phosRule=phosPatterns.get(i);
                                  Pattern phosPattern=Pattern.compile(phosRule);
                             Matcher phosMatch=phosPattern.matcher(line1);
                             System.out.println("Patterns"+phosPattern);
                             if(phosMatch.find())
                                       System.out.println("LINE found::" +line1);
                                       System.out.println("Pattern found:: M"+i+" : "+phosMatch.group()+"\n");
                                       line1=line1.replace("PHOSphorylatable","phosphorylataBLE");
         catch(IOException ie)
                   System.out.println("Match not found");
    And i need to pass the value of '*amino*' from the program to the file during compilation. but it is getting compiled as a text..means getting read as 'amino' word only , not as a it's values defined in the program.
    so please help me out ,how i can pass the values of amino to the file.and i should read the value of amino* when pattern is being compiled.and should not read as a text(amino word itself).
    Edited by: GauravIT on Feb 8, 2008 4:11 AM

  • Regular expression to get substring from string

    Hi,
    I’m having the following problem:
    SELECT REGEXP_SUBSTR(';first field;ir-second field-02;ir-second field-01; third field','.*ir-(.*)-01.*’)FROM dual
    [\CODE]
    This is the select that I have with a java expression!
    In java I’m able to do find the right expression to retrieve what I want, but I don’t know how to adapt this for oracle!
      In oracle I was trying to do something like this:
    NVL(SUBSTR(REGEXP_SUBSTR(CONCAT(';', list),';ir-[^01;]+'),LENGTH(';ir-')+1,LENGTH(REGEXP_SUBSTR(CONCAT(';',list),';ir-[^01;]+'))), ' ') AS result
    [\CODE]
    But it doesn’t work because “ir” can repeat in other parameters.
    “ir-something-01” only appears once.
    Is it in oracle a logic similar to result groups in oracle?
    best regards,
    Ricardo Tomás

    rctomas wrote:
    Hi,
    In java I’m able to do find the right expression to retrieve what I wantWell, would be nice to tell us what that right expression would be :). Anyway, is this what you are looking for:
    SQL> SELECT REGEXP_SUBSTR(';first field;ir-second field-02;ir-second field-01; third field',';ir-([^;]*)-01')
      2  from dual
      3  /
    REGEXP_SUBSTR(';FIR
    ;ir-second field-01
    SQL> SY.

Maybe you are looking for

  • Migrating Spamassassin Bayes DB

    I am migrating a 10.5 mailserver to new hardware running 10.6. The old mailserver uses a global spamassassin db stored in /var/amavis/.spamassassin and the files in this dir are as follows: -rw------- 1 _amavisd _amavisd 42123264 Dec 8 22:42 auto-whi

  • Why can't Apple install an iTunes Visualizer option??

    Why can't Apple install an iTunes Visualizer option to the screen saver, instead of the iPhoto slideshow??  I don't always want pictures moving over the screen, and especially when I'm listening to the music channels. Having such a large format for t

  • How to do GAP analysis ?

    Hi Experts, How to do GAP analysis ? I have a BW problem statement about SD module. I have to do a GAP analysis. I am doing it for the first time. So any suggestion about the approach to start it ? Thanks

  • Duplicate Themes in theme chooser

    I just installed Keynote 3.0 on my PB last night and noticed that when I open a new presentation, all the themes I have purchased from Jumsoft are displayed twice. Can someone help make this go away? Does Keynote 3.0 put themes in a different place/l

  • **UPDATED 5/10 (Features Request) Walkman/Music Unlimited integration

    UPDATED 5/10/14 Dear Miko Ishida and team Great update on the latest Xperia Walkman app (8.3.A.0.5). A Big thank you for Maiko Ishida and the development team for the amazing new interface and Music Unlimited improved integration. However, even it is