简体   繁体   中英

How to replace text in NetBeans using regular expressions?

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?

您可以尝试这样做以匹配内容。

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->(.*)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM