A small example of using the Notepad ++ regular expression to complete complicated replacement

Source: Internet
Author: User

Problem description

================

Find hundreds of lines of code on the network and copy it to a local device for testing.

To make the blog look good, the Code author adds a line number to the code.

After the code is copied, the front of each line contains a numeric row number and a vertex.

 

 

If you want to manually delete these line numbers and points, the code of a dozen lines will be taken care of, but the hundreds of lines of code won't hurt in time.

So I studied the replacement of Notepad ++ Regular Expressions by the way.

 

Try

==================

At the beginning, I wrote the following replacement formula:

Search:

\ D {1, 3 }\.

Replace:

Blank

The result is not work.

 

After further research, we found that the regular expressions supported by notepad ++ are a little different from those supported by normal regular expressions.

I found the help document of Notepad ++ and wrote another expression in the supported format.

Search:

\ D + \.

Replace:

Blank

 

Successful!

Solve the problem.

 

References

====================

How to use regular expressions in Notepad ++ (tutorial)

Http://sourceforge.net/apps/mediawiki/notepad-plus/index.php? Title = Regular_Expressions

Getting started with regular expressions in 30 minutes

Http://www.oicto.com/html/regex.htm

Related Article

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.