In this section you will learn how to compile a pattern with multiple flags like multiline, case insensitivity of the characters in the string etc. This section provides you an example for the implementation of the concept about how is it done? Following program has been used some APIs for compiling pattern with multiple flags i.e. explained ahead.
This program has mentioned string "Abc\ndef" as a input string and compiles the string "\n" which lies in the input string and replaced by the string "\t" after checking whether the pattern string either found or not in the input string. Here in the given program, the pattern string ("\n") is splitted from the input string.
Pattern.compile(patternStr, Pattern.MULTILINE |
Above method compiles the string assigned with the String type variable patternStr with multiple flags which are given follows:
Here is the code of the program:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Compiling a Pattern with Multiple Flags
Post your Comment