wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 19656
    
  18

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Regular Expression : Case insensitive match as well as White Space igonre
 
Similar Threads
Struts 2.2.3 jasper ImageServlet problem
Scanner skip
name for servlets
NX: URLyBird, a question about GUI.Thx!!
Which creational pattern should I use?