如何搜索$ {foo}并替换为< c:out value =“$ {foo}”/>在Eclipse编辑器中? [英] How to search for ${foo} and replace by <c:out value="${foo}"/> in Eclipse editor?

查看:136
本文介绍了如何搜索$ {foo}并替换为< c:out value =“$ {foo}”/>在Eclipse编辑器中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b

之前:



$ {person.dog.name}



之后:



< c:out value =$ {person.dog.name}/>



我需要在Eclipse编辑器中使用它,内部部分更改。






这也可以有用:



搜索: \ $ \ {(。*?)\}



替换: \ $ \ {fn:escapeXml\($ 1\)\}

  $ {person.dog.name} 

成为

  $ {fn:escapeXml(person.dog.name)} 


解决方案

查找表达式:

 (\ $ \ {[^ \}] + \})

,替换表达式将是:

 < c:out value =$ 1/> 

要查找 $ {person.dog.name} < c:out value =$ {person.dog.name}/>



编辑:



使用它时要小心,因为< c:if test = $ {foo}> 将最终像< c:if test =< c:out value =$ {foo}/>> ;


Is there a regex to replace the outer part of a string while keeping the inner part?

before:

${person.dog.name}

after:

<c:out value="${person.dog.name}"/>

I need to use it in Eclipse editor, and the inner part changes.


This can be useful too:

Search: \$\{(.*?)\}

Replace:\$\{fn:escapeXml\($1\)\}

${person.dog.name}

become

${fn:escapeXml(person.dog.name)}

解决方案

Find expression with:

(\$\{[^\}]+\})

and replace expression will be:

<c:out value="$1"/>

To find ${person.dog.name} with <c:out value="${person.dog.name}"/> in Eclipse editor!

Edit:

Be careful while using it, because <c:if test="${foo}"> will end up like <c:if test="<c:out value="${foo}" />">

这篇关于如何搜索$ {foo}并替换为&lt; c:out value =“$ {foo}”/&gt;在Eclipse编辑器中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆