---
title: "MyEclipse  正则表达式 替换 代码"
author: "gary_bu"
date: "2014-07-22T18:01:31Z"
tags: []
categories: ["Web前端"]
slug: "myeclipse"
draft: false
lastmod: "2014-07-22T18:01:31Z"
id: 2095077
url: "https://gary-bu.iteye.com/blog/2095077"
---

用MyEclipse 开发时,如遇到多出代码需要替换,可以使用快捷键CTRL + H 搜索,搜索是支持正则表达式的

 如下图:

       1处填写正则表达式,

       2处选中 Regular expression 支持

       3处对文件类型进行筛选,只查找jsp文件

       4处选中要查找的项目

       ![](http://dl2.iteye.com/upload/attachment/0099/4304/24d92571-5df6-3484-bbf1-4c53bcb4a8b8.jpg)

点击Search 按钮搜索,查询出结果后,选中结果,右键 Replace Selected

如下图:

             ![](http://dl2.iteye.com/upload/attachment/0099/4306/ce98d0b7-6f74-3b2b-b965-350959f07955.jpg)  
 

 点击Replace Selected,出现下图对话框,在红色框内输入要替换的代码,这里也支持正则表达式,点击Replace替换就可以了.

             ![](http://dl2.iteye.com/upload/attachment/0099/4313/e35d643a-a659-3db1-a4d3-ab65d8d394e5.jpg)

 

对正则表达式不太了解的可以抽空学习一下.

给2个正则表达式的学习网站

w3cschool  [http://www.w3cschool.cc/regexp/regexp-tutorial.html](http://www.w3cschool.cc/regexp/regexp-tutorial.html)

正则表达式30分钟入门教程 [http://www.jb51.net/tools/zhengze.html](http://www.jb51.net/tools/zhengze.html)

 

 

 

业精于勤荒于嬉