Regular Expressions match line breaks, regular expressions match line breaks

Source: Internet
Author: User

Regular Expressions match line breaks, regular expressions match line breaks

At the beginning, we did not find many \ n html documents, and the results were in the format.

<Table [^>]>. * </table>
The data between tables is incorrect. According to Baidu encyclopedia, the solution is as follows:

\ S Matches any blank characters, including spaces, tabs, and page breaks. It is equivalent to [\ f \ n \ r \ t \ v].
\ S Match any non-blank characters. It is equivalent to [^ \ f \ n \ r \ t \ v].

Therefore, modify the mode:

<Table [^>] +> [\ s \ S] *? </Table>


? In non-Greedy mode, the system prompts that the regular expression matches to the first </table> and stops.





Regular Expression match line feed

Wo (.*?) \ N (.*?) \{

Wo match
(.*?) Match any non-linefeed character
\ N match the linefeed
(.*?) Match any non-linefeed character
\ {Match {

How can a java regular expression match only line breaks?

In the java regular expression, \ r matches only one carriage return and \ n matches only one line feed.

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.