Regular mode modifier

Source: Internet
Author: User

Pattern modifier Description
I Represents the match in and pattern is not case-sensitive
M Treat a pattern as multiple rows, using ^ and $ to indicate that any row can start or end with a regular expression
S If you do not use this mode to fix the symbol, the "." In the meta-character The default cannot represent a newline symbol, and the string is treated as a single line
X Whitespace in the representation pattern is ignored
E The regular expression must be used in a function that preg_replace replace the string (speaking of this function)
A Begins with a pattern string, which is equivalent to a meta-character ^
Z Ends with a pattern string, equivalent to a meta-character $
U The characteristics of regular expressions: is to compare "greed", using this mode modifier can cancel greedy mode

String str = "Abcheabcllo"= Str.replaceall ("(? i) ABC", ""); //Replace search ABC ignore case other modifiers same usage (? i) (? m) (? s) (? x) ... System.out.println (str); // Output Hello

Regular mode modifier

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.