UltraEdit提供了正则表达式的查找与替换,灵活使用可以节省工作量
使用方法是:^(正则表达式^)
匹配的话,按使用正则表达式的数量,匹配结果为^1、^2并以此类推。
例子:
replace:
public void set^([0-9a-zA-Z]+^)(Float ^([0-9a-zA-Z]+^)) {
this.^([0-9a-zA-Z]+^) = ^([0-9a-zA-Z]+^);
}
with:
public Float set^1(Float ^2) {
this.^3 = ^4;
return this.^3;
}
before replace:
public void setId(Float id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
after replace:
public Float setId(Float id) {
this.id = id;
return this.id;
}
public void setName(String name) {
this.name = name;
}