Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetBeans replace all constants using regular expression

I'm using NetBeans and I want to know what regular expression to use to add single/double quotes around each constant. Every constant is defined like this:

define(SYSTEM_BASEDIR, '/base/dir');

Afaik, that is not the correct way. I need to convert all constants to this:

define('SYSTEM_BASEDIR', '/base/dir');

Thanks in advance to all helpers!

like image 818
Stylock Avatar asked Feb 07 '13 09:02

Stylock


1 Answers

You are correct that define(SYSTEM_BASEDIR, '/base/dir'); is invalid syntax since you are using the constant before defining it.

Now for the regex:

Open up the Replace Dialog (Ctrl+H)

Find What: define\((\w*),

Replace With: define("$1",

This will turn this:

define(BLA,"test");

into:

define("BLA","test");
like image 134
Gung Foo Avatar answered Sep 20 '22 22:09

Gung Foo