NetBeans replace all constants using regex
I am using NetBeans and I want to know what regex to use to add single / double quotes around each constant. Each constant is defined as follows:
define(SYSTEM_BASEDIR, '/base/dir');
Afaik, this is not the right way. I need to convert all constants to this:
define('SYSTEM_BASEDIR', '/base/dir');
Thanks in advance to all the helpers!
+3
source to share
6 answers
You are correct, which define(SYSTEM_BASEDIR, '/base/dir');
is invalid syntax, since you are using a constant before you define it.
Now for the regex:
Open the Replace dialog box ( Ctrl+ H)
Find what: define\((\w*),
Replace with: define("$1",
This will do the following:
define(BLA,"test");
in
define("BLA","test");
+6
source to share