Programming Tips - How do I convert Perl regular expression modifiers to Java Patterns

Date: 2012dec18 Language: Perl, Java, Scala Keywords: regex Q. How do I convert Perl regular expression modifiers to Java Patterns A.
Perl -> Java /m Pattern.MULTILINE /s Pattern.DOTALL /i Pattern.CASE_INSENSITIVE /x Extend your pattern's legibility by permitting whitespace and comments. Details in /x /p Preserve the string matched such that ${^PREMATCH}, ${^MATCH}, and ${^POSTMATCH} are available for use after matching. /g Global. Depends where you use the Pattern /c Keep the Current position after failed matching. Not equivalent. /e Execute. Not directly available. You can read code that loops over matches /u Always in Unicode /a, /d, /l These modifiers, all new in 5.14, affect which character-set semantics (Unicode, etc.) are used