• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regular Expression for Finding data inside (.......)  RSS feed

 
Ranch Hand
Posts: 88
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a string like "United Arab Emirates Dirham(((AED)(BED)(DED)))". I need out put only "AED","BED","DED".But using below code its giving me output like "((AED","BED","DED".

Code:



Can any one help me with the regular expression.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The capture group (.*?) matches any character zero or more times reluctantly, which explains why the first capture group of the first match yields ((AED.

What you need is to not just match any character as part of the first capture group, but the range of A through Z exclusively (assumption on my part).
Have a look at the Pattern API for clues on how to do that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!