Results 1 to 1 of 1
  1. #1
    BMF
    BMF is offline Member
    Join Date
    Jul 2011
    Posts
    1
    Rep Power
    0

    Default Pattern problem (capturing groups)

    Hi all,

    I am trying to match strings that consist of two identical vowels. This should be a super-easy task, but somehow it doesn't work. My regular expressoin is "([aeiou])\1".

    The following statement returns false:

    Pattern.matches("([aeiou])\1", "aa");

    Can anyone help? It is my first time using capturing groups so I may be doing something wrong. However, the examples I read here seem to indicate I am doing it fine?

    Thanks in advance.

    EDIT: Oh nevermind, I just needed to escape the backslash... "([aeiou])\\1".
    Last edited by BMF; 07-14-2011 at 12:57 PM.

Similar Threads

  1. Video Capturing Problem from JMStudio
    By asifzbaig in forum Advanced Java
    Replies: 0
    Last Post: 05-28-2011, 09:07 PM
  2. Groups of swing objects
    By plrca2 in forum AWT / Swing
    Replies: 12
    Last Post: 12-07-2010, 02:56 AM
  3. pattern matcher problem
    By shashanksworld in forum New To Java
    Replies: 1
    Last Post: 04-02-2010, 02:55 AM
  4. Problem with observer pattern
    By livnihai in forum New To Java
    Replies: 5
    Last Post: 10-11-2009, 02:34 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
  •