Results 1 to 6 of 6
  1. #1
    adhoc334 is offline Member
    Join Date
    Aug 2010
    Posts
    15
    Rep Power
    0

    Default Using regex to retrieve all text inside parentheses

    Hi. My program will be parsing syntax coming from the user, and certain bits of data will be designated inside parentheses (like a URL or date, for instance).

    Since multiple parentheses will probably show up in the syntax, I don't want to settle for finding the index of an opening parenthesis and substringing the rest from there.

    Is there any way to accomplish this task in regex?

    I want to store each string found between each set of parentheses in a List and parse each string individually.

    For example:
    String syntax = "foo foo (12-12-10)(http://www.foo.bar)";

    List fromParentheses = returnEverythingInsideEachParentheses(syntax);

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

  3. #3
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    IgnoreList++
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  4. #4
    adhoc334 is offline Member
    Join Date
    Aug 2010
    Posts
    15
    Rep Power
    0

    Default

    What the heck? Is this the same forum or something??

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,453
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by adhoc334 View Post
    What the heck? Is this the same forum or something??
    No, that's why it's called 'crossposting'. Suppose I wanted to reply and anwser your question while someone already did the same in that other forum; I'd be wasting my time and would you care?

    kind regards,

    Jos

  6. #6
    adhoc334 is offline Member
    Join Date
    Aug 2010
    Posts
    15
    Rep Power
    0

Similar Threads

  1. Retrieve array inside a list as a Map value
    By Ms.Ranjan in forum Advanced Java
    Replies: 2
    Last Post: 08-04-2010, 12:30 PM
  2. I can't read a text file located inside my jar.
    By Serrano0811 in forum New To Java
    Replies: 1
    Last Post: 04-21-2010, 05:03 PM
  3. Replies: 15
    Last Post: 03-02-2010, 07:09 PM
  4. Retrieve values of Text boxes using LIST
    By Kayal in forum Web Frameworks
    Replies: 2
    Last Post: 03-20-2009, 11:00 AM
  5. problem aligning both image/text inside a button
    By rick_cols in forum SWT / JFace
    Replies: 0
    Last Post: 09-18-2008, 08:20 PM

Posting Permissions

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