• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regular Expression : Case insensitive match as well as White Space igonre

 
Kowshik Nandagudi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to specify in the Pattern class that I want to ignore spaces as well as ignore case

Pattern class has two constants

Pattern.CASE_INSENSITIVE ;
Patteren.COMMENTS ;

How do i specify in
Pattern.compile(regex,???);


Thanks in advance
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Javadocs mention that the flags variable is
a bit mask that may include CASE_INSENSITIVE, MULTILINE, DOTALL, UNICODE_CASE, CANON_EQ, UNIX_LINES, LITERAL and COMMENTS

That means that you can use the binary operator | to combine them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic