aspose file tools*
The moose likes Java in General and the fly likes  Regular Expression : Case insensitive match as well as White Space igonre Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark " Regular Expression : Case insensitive match as well as White Space igonre" Watch " Regular Expression : Case insensitive match as well as White Space igonre" New topic
Author

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

Kowshik Nandagudi
Ranch Hand

Joined: Dec 09, 2010
Posts: 57
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

Joined: Oct 27, 2005
Posts: 19692
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regular Expression : Case insensitive match as well as White Space igonre