• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regular expression pattern ${* }  RSS feed

 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to find pattern ${* } using Regular expression. For example, String �ABC ${opop } XYZ� should return true. How to write the code?

This code does not work.

Thanks.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try

Pattern pat = Pattern.compile("\\Q${\\E.*}");


Since $ is meta character in regular expressions you need to espace them using \\Q (quote) and \\E (end)
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works. Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!