[英]How to replace text in NetBeans using regular expressions?
How can I replace text in NetBeans using regular expressions? 如何使用正则表达式替换NetBeans中的文本?
For instance, 例如,
I want to replace these texts below, 我想在下面替换这些文本,
$item->article_id
$item->title
$item->content
...
with 同
$item['article_id']
$item['title']
$item['content']
...
I tried with this below in the input field of ' Containing Text: ' 我在下面的“ 包含文本: ”的输入字段中尝试了此操作
$item->(.*)
But no match found . 但没有找到匹配 。
Any ideas? 有任何想法吗?
您可以尝试这样做以匹配内容。
item->([a-z]*...)
If you write special characters, like $
sign in the Find what input, you must escape it with \\
(backslash). 如果您编写特殊字符,例如“ 查找内容”输入中的$
符号,则必须使用\\
(反斜杠)对其进行转义。 But you don't need replace the $
sign with another $
sign. 但是您不需要将$
符号替换为另一个$
符号。
In Find what : 在查找内容中 :
item->(.*)
In Replace with : 在替换为 :
item['$1'];
Then press replace all. 然后按全部替换。 That's all. 就这样。
Use this 用这个
item->([a-z]*)
or 要么
item->(.*)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.