Regulare Expressions - Uses of logical operators

I need to make use of logical operators within a regulare expression. (greater than, equal, etc.)
It seems to me that java.util.regex.Pattern does not support that kind of expression. First of all: Is this true (If I am wrong with my assumption, how would the expression look like). Secondly: Which library does support this expression?
Thanks in advance!

Regular expressions deal with characters. In that context all characters are 'equal'. You better explain your question a helluva lot better than that.

Similar Messages

  • Advanced Search using conditional & logical operators+ sharepoint 2010

    Hi Team,
    We have an requirement something like this. we have to search values from Custom SharePoint List using Conditional & Logical Operators in SharePoint 2010. how can i achieve this ? if some one has worked on something like this, can you please share the
    details to my email id ([email protected]
    Thanks in Advance.
    Cheers, San

    Hi Santhosh,
    If you have only one list, then you can use CAML query to perform search in that list. You can write code to generate dynamic CAML based on selection in the filter.
    If have to perform the search function on multiple list then you can use Search object model and create dynamic query and execute it using Search OM.
    http://msdn.microsoft.com/en-us/library/office/dn423226(v=office.15).aspx
    Best Regards,
    Brij K

  • How to define a regular expression using  regular expressions

    Hi,
    I am looking for some regular expression pattern which will identify a regular expression.
    Also, is it possible to know how does the compile method of Pattern class in java.util.regex package work when it is given a String containing a regex. ie. is there any mechanism to validate regular expression using regular expression pattern.
    Regards,
    Abhisek

    I am looking for some regular expression pattern which will identify a regular
    expression. Also, is it possible to know how does the compile method of
    Pattern class in java.util.regex package work when it is given a String
    containing a regex. ie. is there any mechanism to validate regular
    expression using regular expression pattern.It is impossble to recognize an (in)valid regular expression string using a
    regular expression. Google for 'pumping lemma' for a formal proof.
    kind regards,
    Jos

  • Regular Expressions + using them in Vector analysis

    Hello,
    I would be very glad for any hint concerning this problem:
    Consider this ilustrational code sample
    import java.util.regex.*;
    Vector sequence = new Vector();
            sequence.add("-");
            sequence.add("-");
            sequence.add("A");
            sequence.add("-");
            sequence.add("B");I want to find the first occurence of any alphabetical character ...I thought I can do it like this:
    int index = sequence.indexOf("\\w");or from the other point of view like this:
    int index = sequence.indexOf("[^-]");Unfortunately none of these are working. Do you know why and how to fix this? There are supposed to be only alphabetical characters and "-" character...
    thanks a lot
    adam

    mAdam wrote:
    well, the code I posted above should suit only as an illustration of my problem.
    ActualIy I have a bunch of those sequences in an Arraylist...it can be from 5 - 100 sequences(vectors) and I need to use some methods which are available only for Collections (frequency(), insertElementAt()...etc.). I am not a proffesional programmer so I do hope that I am using it correctly instead of "simple" String[][] BunchOfSequences = {seq1,seq2,...}I am not aware of any frequency() or insertElementAt() methods in one of Java's collection classes.
    Is it possible to use regular expressions to find a first occurence of a "a-z"(or "A-Z"..it doesnt matter) in a vector then? Or I just need to find it in a "for loop"?
    thx
    adamRegexes only work on Strings, not on collections holding Strings. So yes, you will need to use a for statement (or similar).
    List<String> list = ...
    for(String s : list) {
      if(s.matches("\\w")) {
    }

  • Regular expression: using replaceAll

    I have the following input text:
    hello javascript:link('1') bye
    hello javascript:link('2') bye
    hello javascript:link('2') bye
    javascript:link('3') hello javascript:link('2')
    I am using the folllowing regular expression:
    javascript:link(\\(.*?\\))
    in the following code:
    File file = new File("C://simple.txt");
    String regex = "javascript:link(\\(.*?\\))";
    String replacement = "REPLACED";
    String output = "";
              BufferedReader input;
              try {
              input = new BufferedReader(new FileReader(file));
                   String text = input.readLine();
                   while(text != null) {             
              Pattern pattern = Pattern.compile(regex);
              Matcher matcher = pattern.matcher(text);
              if(matcher.find()) {
              output = matcher.replaceAll(matcher.group(1) + replacement);
                        System.out.println(output);
                   text = input.readLine();               
              catch (Exception e) {
                   e.printStackTrace();
    And my output is:
    hello ('1')REPLACED bye
    hello ('2')REPLACED bye
    hello ('2')REPLACED bye
    ('3')REPLACED hello ('3')REPLACED
    Firstly, why do the brackets appear in ('1'). I would expect '1'
    Secondly, how do I get the output to say ('3')REPLACED hello ('2')REPLACED, instead of ('3')REPLACED hello ('3')REPLACED

    The examples I gave work with what you have suggested.
    I now need to take it a step further. This is my code now:
    String test = "javascript:link('3X') hello javascript:link('2') hello javascript:link('3X')";
    String pattern = "javascript:link\\('(.*?)X'\\)";
    System.out.println(test.replaceAll(pattern, "$1:REPLACED"));
    But the output is:
    3:REPLACED hello 2') hello javascript:link('3:REPLACED
    I would like the output to be:
    3:REPLACED hello javascript:link('2') 3:REPLACED
    How can I achieve this?

  • DOM Parser fails with regular expression using anchor (carat, dollar)

    I'm using version "Oracle XDK Java 9.0.4.0.0 Production"
    In trying to parse XML against schema: a regular expression fails to parse the data "8:00" with the following simple regular expression: "^.*$" (used to narrow the error)
    The error message is
    <Line 14, Column 25>: XSD-2025: (Error) Invalid text '8:00' in element: 'XYZ'
    If I remove the anchors and just have ".*", the data is parsed successfully.
    I dont understand why the parse fails when I use a anchors in the regular expression, and the java Pattern/Matcher classes succeed with the anchors?

    That "ns670" string is an xml namespace prefix. it should have a corresponding xml namespace declaration somewhere in the xml document (i'm guessing you have not shown the whole document). the actual value of an xml namespace prefix is meaningless. if you parse the xml with a namespace aware DOM parser, it should generate Nodes with the correct namespace. the namespace is the value you care about when extracting data from the document, not the namespace prefix.
    alternately, if you parse the document using a namespace aware DOM parser, you can just look for nodes based on their "local" name (the part after the ":" separator) and ignore the namespace/prefix.
    whatever you do, please do not parse the xml with a regex, see this http://stackoverflow.com/a/1732454/552759 for details (applies to xml as well).

  • Regular expression evaluation with logical operator

    Hi All,
    I am bit confuse with expression evaluation with logical operator. I am trying to understand below expression.
    eXa.getTrue() && eXa.getFalse() || eXa.getFalse() && eXa.getTrue() || eXa.getFalse() comes as false and True Count: 1 False Count: 3
    As per understanding it should be true with True Count: 1 False Count: 3
    it should execute 1st getTrue() and then 1stGetFalse() and then 2nd getfalse() and should skip 2nd getTrue() and execute 3rd fetFalse()
    eXa.getTrue() && eXa.getTrue() || eXa.getFalse() && eXa.getTrue() || eXa.getFalse() comes as true and True Count: 2 False Count: 0
    As per understanding it should be true with True Count: 3 False Count: 0
    it should execute 1st 2 getTrue() and skip 1st getFalse() and then execute 3rd getTrue() and skip last getFalse().
    eXa.getTrue() || eXa.getFalse() && eXa.getFalse() || eXa.getTrue() && eXa.getFalse() comes as true and True Count: 1 False Count: 0
    As per understanding it should be true with True Count: 2 False Count: 2
    it should execute 1st getTrue() and skip 1st getFalse() and then execute 2nd getFalse() and then execute 2nd getTrue() and then 3rd getFalse()
    Please help me to understand above expressions.
    Here is the methods definition:
    private boolean getTrue() {
              trueCount++;
              boolean retrunValue = 4 > 3;
              return retrunValue;
    private boolean getFalse() {
              falseCount++;
              boolean retrunValue = 3 > 4;
              return retrunValue;
    Thanks for ur help

    >
    adding parenthesis to make order of ops more obvious. adding "?" to show un-executed calls.
    (eXa.getTrue() && eXa.getFalse()) || (eXa.getFalse() && eXa.getTrue()) || eXa.getFalse()  comes as false and True Count: 1 False Count: 3
    (T && F) = F
    (F && ?) = F
    (F) = F
    F || F || F = F
    (eXa.getTrue() && eXa.getTrue()) || (eXa.getFalse() && eXa.getTrue()) || eXa.getFalse()  comes as true and True Count: 2 False Count: 0
    (T && T) = T
    (? && ?) = ?
    (?) = ?
    T || ? || ? = T
    eXa.getTrue() || (eXa.getFalse() && eXa.getFalse()) || (eXa.getTrue() && eXa.getFalse())  comes as true and True Count: 1 False Count: 0
    (T) = T
    (? && ?) = ?
    (? && ?) = ?
    T || ? || ? = T

  • Regular expressions, using pattern and matcher but not include the pattern

    Hi all
    i have a regular expression but in my matcher it is including the text that is in my regular expression.
    ie
    String str="-------------------stuff===========";
    Pattern mainBody = Pattern.compile("-----(.*?)=====", Pattern.MULTILINE);this matches -------------------stuff=====
    now i expect to get some - in there as i match from the start, but i dont want to have the = in the match. how do i do a match that excludes the matching expressions.

    nevermind, figured it out
    when i do myMatch.group(1) it gives me just my match
    sorry for wasting time :)

  • Regular expressions using jsp

    Hello Techies,
    I am having a text area inside a jsp file. When ever the end user gives input it must be submitted to the server.
    The real problem is when the end user gives special characters and double-quotes in this text area, jsp is preforming in abnormal way.
    Can u guys tell me how to resolve this issue. i.e how to solve regular expressions in jsp.
    Even though the end user gives special characters or double quotes we should take only the content.
    Looking forward for u reply.
    regards,
    Ramu

    The real problem is when the end user gives special characters and double-quotes in this text area, jsp is preforming in abnormal way.What do you mean with "jsp is preforming in abnormal way" ?
    A arbitrary JSP does not care about double-quotes.
    Can u guys tell me how to resolve this issue. i.e how to solve regular expressions in jsp.Usually the same way as you do it in a poj class.
    Nobody here knows how your JSP looks like and who handles the request when the form is submited or even who generates the model of the data displayed by your JSP.
    You have to provide us with more details.

  • How to use regular expression using pattern and match concept for this scenario?

    Hi Guys,
    I have a string "We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle"
    I need to replace the numbers based on the below condition.
    if more then 5, replace with many
    if less then 5, replace with a few
    if it is 1, replace with "only one"
    below is my code, I am missing the equating part to replace the numbers could any one of you please help me out fixing this.
    private static String REGEX="(\\d+)";
      private static String INPUT="We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle";
      //String pattern= "(.*)(\\d+)(.*)";
      private static String REPLACE = "replace with many";
      public static void main(String[] args) {
      // Create a Pattern object
           Pattern r = Pattern.compile(REGEX);
        // Now create matcher object.
           Matcher m = r.matcher(INPUT);
           //replace the value 7 by the replace string
    //How to equate the (\\d+)  greater than a number  and use it the below code.
                  INPUT = m.replaceAll(REPLACE);
           //Print the final Result;
            System.out.println(INPUT);
    Thanks and Regards,

    Hi,
    Try the following which makes use of  "appendReplacement" instead with the "start" and "end" methods to locate and check the searched "regExp" string before dynamically setting the "replace" string:
    String regExp = "\\d+";
    String input = "We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle";
    String replace;
    Pattern p = Pattern.compile(regExp);
    // get a matcher object
    Matcher m = p.matcher(input);
    StringBuffer sb = new StringBuffer();
    while (m.find()) {
       Integer x = Integer.valueOf(input.substring(m.start(), m.end()));
       replace = (x >= 5) ? "many" : (x == 1) ? "only one" : "few";
       m.appendReplacement(sb, replace);
    m.appendTail(sb);
    System.out.println(sb.toString());
    HTH.
    Regards,
    Rajen
    P.S: Please mark the post as answered/helpful if it resolves your issue for the benefit of all community members.

  • Java regular expressions using enum

    Hi,
    i have created an enum called MONTHS and would like to include it in a pattern. Can somebody give me a hint on how to do that? Should i do it manually (by creating a string like [Jan,Feb...]) or is there a better way?
    Thanks

    It works by iterating the months and getting a string: months= "Jan|Feb|..." and then appending it to the pattern string. For example:
        public static String getMonthsShortStringList()
            String sList="";
            for (MONTH_SHORT c: MONTH_SHORT.values())
                sList+=c.toString()+'|';
            String newS=sList.substring(0,sList.length()-1);       
            return newS;
        }//getMonthsShortStringList
    and  then...
    String months=DateConsts.getMonthsShortStringList(); //get a months disjunctive list
    Pattern pattern1=Pattern.compile("("+months+")");
    Matcher matcher1=pattern1.matcher((CharSequence)s);
    boolean found1=matcher1.find();Is there an alternative to this?

  • Using logical operators when creating software groups

    Is there a way to use simple logical operators when using filters for creating software groups?
    An example of what I want to do is to select all updates for the past month - but not include Definition Updates for instance. So all update classifications but NOT definition updates.

    The '-' trick only works for ADRs to my knowledge.
    For searching within the console, anytime you add criteria for the same attribute, it always adds it with an OR. This is a known design shortfall.
    For your question specifically though, you need to reverse your thinking and instead of being exclusive, think inclusively. Thus, you can add an attribute multiple times to the search criteria by selecting and adding it multiple times  -- once for each
    classification that's not definition updates. Then, save the search as pointed out by Torsten.
    Jason | http://blog.configmgrftw.com

  • Using Logical operators in filters

    Hi All,
    I want to filter rows from an XML using AND logical operator.
    <?xml version="1.0" encoding="UTF-8" ?>
    <RowSet>
    <Row>
    <Name>jake</Name>
    <Sem>First</Sem>
    <Score>100</Score>
    </Row>
    <Row>
    <Name>jake</Name>
    <Sem>second</Sem>
    <Score>200</Score>
    </Row>
    <Row>
    <Name>pete</Name>
    <Sem>First</Sem>
    <Score>300</Score>
    </Row>
    </RowSet>
    I want all the results with Name='jake' and Sem='First'.I tried this usig the AND operator but couldnt get the result .
    I tried :
    <?for-each-group: Row/{./Name='jake'} AND Row/{./Sem='Score'}?>
    <?Name?>
    <?Score?>
    <?end for-each?>
    This doesnt seem to work(with flower brackets repalced by square brackets).Although the OR operator works with the '|'(pipe) symbol in the same manner.
    Any suggestion on how to use the logical operators.
    Thanks!!
    Edited by: rick_me on May 23, 2009 2:09 AM
    Edited by: rick_me on May 23, 2009 2:10 AM

    Hi,
    Use:
    <?for-each:Row[./Name='jake' and ./Sem='First']?>
    <?Name?>
    <?Score?>
    <?end for-each?>Regards,
    Colectionaru

  • 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*)

  • Problem in creating a Regular Expression with gnu

    Hi All,
    iam trying to create a regular expression using gnu package api..
    gnu.regex.RE;
    i need to validate the browser's(MSIE) userAgent through my regular expression
    userAgent is like :First one ==> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
    i wrote an regular expression like this:
    Mozilla.*(.*)\\s*(.*)compatible;\\s*MSIE(.*)\\s*(.*)([0-9]\\.[0-9])(.*);\\s*(.*)Windows(.*)\\s*NT(.*)\\s*5.0(.*)
    Actaully this is validating my userAgent and returns true, my problem is, it is returning true if userAgent is having more words at the end after Windows NT 5.0 like Second One ==> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Testing
    i want the regularExpression pattern to validate the First one and return true for it, and has to return false for the Second one..
    my code is:
    import gnu.regexp.*;
    import gnu.regexp.REException;
    public class TestRegexp
    public static boolean getUserAgentDetails(String userAgent)
         boolean isvalid = false;
         RE regexp = new RE("Mozilla.*(.*)\\s*(.*)compatible;\\s*MSIE(.*)\\s*(.*)([0-9]\\.[0-9])(.*);\\s*(.*)Windows(.*)\\s*NT(.*)\\s*5.0(.*)");
         isvalid = regexp.isMatch(userAgent);
         return isvalid;
    public static void main(String a[])
         String userAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
         boolean regoutput = getUserAgentDetails(userAgent);
         System.out.println("***** regoutput is ****** " + regoutput);
    }please help me in solving this..
    Thanks in Advance..
    thanx,
    krishna

    Ofcourse, i can do comparision with simple string matching..
    but problem is the userAgent that i want to support is for all the MSIE versions ranging from 5.0 onwards, so there will the version difference of IE like MSIE 6.0..! or MSIE 5.5 some thing like that..
    any ways i will try with StringTokenizer once..!
    seems that will do my work..
    Thanks,
    krishna

Maybe you are looking for

  • Adding custom fields to the condition table in CRM

    Hi all, Our requirement is to download the sales conditions type from R3 to the CRM system. In one of the condition table we are trying to add shipping point( VSART ) and Special processing indicator (SDABW). For that we have added the fields in the

  • Older canon ZR 85 won't show up on newish imac through 8 pin fire wire

    imac 2.93intel2 and running OSX10.6.2. trying to upload video from older canon ZR 85. this means the newer 8 pin firewire. camera will not show up on imovie9. is the 8 pin firewire supported with the older camera? do I need a 6 pin and an adapter?

  • ASCP Table name for Recipe 'Preference' field

    I have separate Planning and Production recipes for the same item. ASCP is required to plan using planning recipes - and batches would be created manually refererring ASCP output using production recipes (there is business reason for this). All plann

  • Adding Customer Fields - Note 672960

    Hi All, Forgive me for this but I am new to BAdI programming and need a bit of help. I have been given a spec to add customer fields to a screen. The Analyst has given me the list of fields and reference to SAP Note 672960. I have appended the fields

  • PI 7.4 - interface from ECC(idoc) JDBC, idoc not making it from sm58 '

    Hi Experts, I've got an interface  which works in our dev and 2 of our test systems but NOT the 3rd test system. It doesnt work in our live system either. (essentially its a split receiver determination - goes to both jdbc and a file). I've reintrodu