Results 1 to 3 of 3
  1. #1
    Ms.Ranjan is offline Member
    Join Date
    Jun 2008
    Posts
    85
    Rep Power
    0

    Default Interpretation of regex?

    can someone plz kindly tell me if my intepretation of the following regular expression is correct.

    Java Code:
    String pattern="[A-Z](a-z([A-Z]+)0-9@-)*([^;\\s])*";
    Match string that has
    1.Capital letter in the starting of the string
    2.Followed by zero or more occurence of
    1.letter ranging a-z
    2.digit ranging from 0-9
    3.symbol @
    4. symbol -
    5.and with atleast one or more occurence of capital letter
    ranging from A-Z
    3.Followed by anything but except a ; and whitespace

    Thanks

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    The pattern can turn up in the middle of a String somewhere, as the beginning-of-line and end-of-line symbols are not used.

    Then
    Java Code:
    A-Z
    0 or more occurrences of
        a-z
        0 or more occurrences of A-Z
        0-9
        @
        -
    0 or more occurences of anything but ; or whitespace
    i.e. All of these match from after the third . until before the <space>
    Java Code:
    ...A+<space>...
    ...Aa0@-b<space>...
    ...Aa0@-a0@-b<space>...
    ...AaA0@-b<space>...
    ...AaA0@-a0@-b<space>...
    Last edited by masijade; 04-23-2009 at 09:29 AM.

  3. #3
    Ms.Ranjan is offline Member
    Join Date
    Jun 2008
    Posts
    85
    Rep Power
    0

Similar Threads

  1. Multiline Regex
    By zriggle in forum New To Java
    Replies: 1
    Last Post: 02-26-2009, 05:49 AM
  2. Some help with regex and loop
    By moaxjlou in forum New To Java
    Replies: 21
    Last Post: 11-02-2008, 11:24 PM
  3. [SOLVED] More RegEx help
    By JT4NK3D in forum New To Java
    Replies: 2
    Last Post: 05-23-2008, 05:07 AM
  4. Regex Quantifiers Example
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-10-2008, 11:44 AM
  5. Regex pattern
    By ravian in forum New To Java
    Replies: 4
    Last Post: 12-11-2007, 11:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •