doudang2817 2015-02-24 09:29
浏览 16
已采纳

如何使用正则表达式替换NetBeans中的文本?

How can I replace text in NetBeans using regular expressions?

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?

  • 写回答

3条回答 默认 最新

  • dsk95913 2015-02-24 09:50
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?