Results 1 to 2 of 2
  1. #1
    torsion is offline Member
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Default Regular expressions: named groups

    Hello.
    I am a python user and need to use java regular expressions. At python I can use something like this: pattern = "(?P<year>\d{4})" so, I can give a name to group. What about this in java?

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    The groups are numbered based upon the grouping order, which allows identification of grouping. Should be enough to pull out a specific group from the regex search
    Lesson: Regular Expressions (The Java™ Tutorials > Essential Classes)

Similar Threads

  1. Regular Expressions Help
    By Death Sickle in forum New To Java
    Replies: 4
    Last Post: 04-04-2011, 04:21 AM
  2. Regular Expressions problem
    By mohammedelbes in forum Advanced Java
    Replies: 7
    Last Post: 01-05-2011, 11:12 AM
  3. regular expressions
    By sozeee in forum New To Java
    Replies: 3
    Last Post: 12-06-2010, 09:58 PM
  4. Get all groups from a regular expression match?
    By johann_p in forum New To Java
    Replies: 0
    Last Post: 05-16-2008, 07:50 PM
  5. Capturing Groups using regular expressions
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-25-2007, 11:19 AM

Tags for this Thread

Posting Permissions

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