• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Usage of Regular Expression

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!

 
Ranch Hand
Posts: 157
1
Android MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try with

\(\d,\d\) pattern.
 
durgs prasad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can i please get a piece of code, where am new to it:))
 
harshvardhan ojha
Ranch Hand
Posts: 157
1
Android MySQL Database Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
durgs prasad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot!! Thisz goin' to help me
 
lowercase baba
Posts: 13086
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
harshvardhan ojha
Ranch Hand
Posts: 157
1
Android MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13086
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 157
1
Android MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sure i will take care next time.
 
reply
    Bookmark Topic Watch Topic
  • New Topic