This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regex help

 
divya kundapur
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a string= $str1$str2$str3$str4$ , what should the regex ?
this did not work "$"+str1+"$*"

Thanks
 
fred rosenberger
lowercase baba
Bartender
Posts: 12086
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What should be the regex for what?

What are you trying to match exactly? Your question is effectively saying

"I have the string 'this is my string'. What should be the regex?"

You have to tell us what you are TRYING to match.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read the Javadoc for java.util.regex.Pattern? What does it say there about $?
 
divya kundapur
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, this is the string i have string= $str1$str2$str3$str4$ , and i need a regular expression to match it .. Any help appreciated.

Thank you
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hava you read the Pattern Javadoc already? That should get you along for now. And keep in mind that you need to treat $ specially, the Javadoc explains why.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic