Help with Java & Regular Expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Akino877
    New Member
    • Nov 2007
    • 37

    Help with Java & Regular Expression

    Hello,
    I have one line of Java and regular expression that I got from the web :
    Code:
    String[] opt;
    opt = line.split("\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
    If "line" contains :
    1 "Hello World"

    this code would give me :
    opt[0] : 1
    opt[1] : "Hello World"


    which is almost what I would like to do except for the double quotes. I wonder if someone could please help me change the regular expression so that it would return :
    opt[0] : 1
    opt[1] : Hello World


    Thank you and Best Regards,

    Akino
    Last edited by Niheel; Jul 18 '11, 10:17 PM.
Working...