Just got good experience with KDE’s Kate editor and must share it.
You have piece of code, which looks like this
if(get_var('submit')){
// still empty..
}else{
$var1=null;
$var2=null;
...
$var100=null;
}
and now you need to put those initializations of var’s to the first block also, getting variables from GET or POST supervariables. What to do? Doing hunderd times of “delete null, paste get_var(”), copy-paste ‘name of variable’” and the day is going to be sooooo long …
Now, in Kate you can do it by one click. Copy all lines “$var..=null;” to first block, select those lines and “ctrl+r” (replace) and put values:
Find: \$(.*)=null;
Replace: \$\1=get_var('\1');
Mode: Regular expression
[V] Selection Only (just incase)
and press “Replace All”. And it’s done:
if(get_var('submit')){
$var1=get_var('var1');
$var2=get_var('var2');
...
$var100=get_var('var100');
}else{
$var1=null;
$var2=null;
...
$var100=null;
}
and explained:
In Find expression you see (.*) – content of parentheses are treated as parameter “one” and referenced later as \1. That what you see in Replace expression \$\1 – will get replaced as “$var1″ and get_var(‘\1′) gets get_var(‘var1′)