aspose file tools*
The moose likes Beginning Java and the fly likes Splitting a string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Splitting a string " Watch "Splitting a string " New topic
Author

Splitting a string

anoop kerala
Greenhorn

Joined: Mar 03, 2010
Posts: 10
Hi,
i want to split a string for example
1) @a.b=@c.d+@e.f;

one output i want is a,c,e which has got prefix '@'

second output i want is is b,d,f which has got prefix '.'

i prefer a solution with regex please..

thanks in advance
lenin
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19696
    
  20

Check out java.util.regex.Pattern. It has lots of information on regexes in Java. Especially check out what capturing groups do.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
Rob Prime wrote:Check out java.util.regex.Pattern. It has lots of information on regexes . . .
There is lots more information in the tutorials, eg this one.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why do you want to use regexes? I'm not convinced that's the easiest solution to this problem.
 
jQuery in Action, 2nd edition
 
subject: Splitting a string