aspose file tools*
The moose likes Java in General and the fly likes Usage of Regular Expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Usage of Regular Expression" Watch "Usage of Regular Expression" New topic
Author

Usage of Regular Expression

durgs prasad
Greenhorn

Joined: May 28, 2012
Posts: 5
String str = "{(1,2),(2,3),(3,4),(4,5)}";
How to split this String using Java Regular Expressions where it should result as below:
(1,2)
(2,3)
(3,4)
(4,5)

Need Help!!

harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

try with

\(\d,\d\) pattern.
durgs prasad
Greenhorn

Joined: May 28, 2012
Posts: 5
Can i please get a piece of code, where am new to it)
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

durgs prasad
Greenhorn

Joined: May 28, 2012
Posts: 5
Thanks a lot!! Thisz goin' to help me
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11401
    
  16

it's too late now, else I would delete the code.

Generally, we try to help people figure things out, not hand them solutions. We feel they learn more doing it themselves rather that being spoon-fed the answer. Further, if this is a class assignment, it leads to possible ethical issues - if durgs prasad takes this code and turns it in, have they plagerized their answer?

In the future, please help people find the answer themselves. Give them tips or suggestions, subtle hints, etc. have them post what they have tried and point out errors, but please do not provide complete answers.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

its ok fred, he already told that he is new, and i hope these things will help him get confidence.
Durgs prasad from next time try your regex on regexpal.com.

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11401
    
  16

harshvardhan ojha wrote:its ok fred, he already told that he is new

You are missing my point.

It is NOT ok. Around here, we don't care if someone has been coding 10 minutes or 10 years...We don't give out answers. That is the policy of this site. It is documented here and here. I suggest you read those before answering another post.
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

sure i will take care next time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Usage of Regular Expression