Notepad++ and Dreamweaver perform a regular lookup replacement

Source: Internet
Author: User


For example: Give a list of values, add <option></option>, <a></a>, and so on to some labels.


The code is as follows

To be replaced by:

<option value= "1" >1</option>
<option value= "2" >2</option>
<option value= "3" >3</option>
<option value= "4" >4</option>


Ctrl+h Open the replacement window and enter in the lookup target: (. +)
Enter in Replace with: <option value= "$1″>$1</option>
Click on "Replace All" to complete this task, very simple.





Here, in Find Target, the () represents a match, and the corresponding representation of the first pair of parentheses in replace with. If you have more than one string to match, use multiple parentheses and pass $, $, $ ... You can replace it. More complex and precise replacements also require more knowledge of regular expressions.

The Dreamweaver replacement input box is larger and is easy to use when multiple lines of content are replaced.


Not only do most editors, such as Notepad,editplus, Dreamweaver, also support regular expressions, they can also bulk replace files in the specified folder, open files, and so on, quite powerful. For a large number of replacement tasks, take a little more time to understand how to apply a good regular replacement function, you can save a lot of time in the work.
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.