RegEx: How to use $1 in replace command?

Hi,

The command dataset.getAsHTML() aligning all columns with numbers at left position. I try to change with RegEx the ‘’ tag to: ‘’, but only for numeric columns.
I try this:

...
var report = '<html>'+ dataset.getAsHTML() +'</html>'

report = '<td >abc</td><td >123</td>'
var pattern = /(>[0-9]+<)/g;
var temp = report.replace( pattern, ' style="text-align: right;" $1' )

But “$1” always is empty and striping founded strings.
How can I solve this problem?

Regards,


Agis

Version 3.5.6-build 519
Java version 1.5.0_13-121 (Mac OS X)

Your code seems fine to me, and if I run it, the temp var contains:```

abc123 ``` at the end, is that not what you want?

Hi Joas,

That is exactly what i need. :)
I restart Servoy and test it again. Now it is working like I want

Thanks


Agis

Version 3.5.6-build 519
Java version 1.5.0_13-121 (Mac OS X)