Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: Re: Regex: Any character in character class Date: Sat, 02 Feb 2013 12:20:30 -0800 Organization: A noiseless patient Spider Lines: 16 Message-ID: References: <5109e49b$0$295$14726298@news.sunsite.dk> <510c380b$0$287$14726298@news.sunsite.dk> <510c3e29$0$287$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 2 Feb 2013 20:20:15 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="fba3415ba68d85d643935af2f52f0b4b"; logging-data="31648"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mSsqY6rgnfP95LBQWHH0EJ+v6OtELEiQ=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: Cancel-Lock: sha1:9Hn2TGLvhxyqx1eOHQUArZdGQXA= Xref: csiph.com comp.lang.java.programmer:22021 On 2/2/2013 11:45 AM, Sebastian wrote: > SCA:LIST, select[werks_s:default_plant],values[bukrs:bukrs, > company:company] For something this simple you might want to consider just String::split(). String test = "SCA:LIST,select[werks_s:default_plant],values[bukrs:bukrs,company:company] "; String[] parse = test.split( ",\\s*", 2 ); System.out.println( Arrays.toString( parse ) ); This could be faster since the second half of the regex, (?:.|\n)+, doesn't have to execute.