Results 1 to 2 of 2
  1. #1
    chkontog is offline Member
    Join Date
    Nov 2012
    Posts
    9
    Rep Power
    0

    Default split string with regex

    Hi,

    i have this string "aaa[word1]ddd", and i would like to take the string "word1" with regex.How i can do this?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,422
    Rep Power
    20

    Default Re: split string with regex

    You're going to have to provide more detalis about the rule by which you want to extract "word1" from "aaa[word1]ddd"

    Given just one input and one output, I could probably arrive at half a dozen different regexes that would pass a test. And to get, literally, "word1" from "aaa[word1]ddd" a simple substring(...) would suffice.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 7
    Last Post: 04-28-2012, 02:10 AM
  2. How to use regex and split to solve a problem
    By PeteClimbs in forum New To Java
    Replies: 2
    Last Post: 04-19-2011, 08:31 PM
  3. Regex and split
    By sunde887 in forum New To Java
    Replies: 2
    Last Post: 02-14-2011, 12:54 AM
  4. How to split a String using split function
    By Java Tip in forum java.lang
    Replies: 4
    Last Post: 04-17-2009, 08:27 PM
  5. How to split a String using split function
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 10-04-2007, 09:32 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
  •