PHP Regular expression matches all characters (can match newline)

Source: Internet
Author: User
Tags html tags php regular expression

On the positive I was a smattering, I am the idea of the regular is, can be used on the line!

For all the characters, my first understanding was. *

Then Google a bit, just know. * Connecting together means any number of characters that do not contain a newline.

So you can use [\s\s]* it means any whitespace character and non-white-space character. Similarly, you can use [\d\d]*], [\w\w]*] to express. D and D,w and W,s and S are all antisense and add up to all the characters.

Note: The n written in the text is not automatically treated as a line break, testing $_= "ASDFNASDF"; s/./-/;p rint;


Add

Matching regular expressions for Chinese characters: [\U4E00-\U9FA5]
Match Double-byte characters (including Chinese characters): [^\x00-\xff]
A regular expression that matches a blank row: \n[\s|] *\r
Regular expression matching HTML tags:/< (. *) >.*<\/\1>|< (. *) \/>/
Matching a regular expression with a trailing space: (^\s*) | (\s*$)

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.