add @pamepros fix, regexp must have 'g' param to replace all ocurrences of pseudo vars