It worked, try pasting in your browser's location field:
javascript:alert("item number:237728".replace(/[^0-9]/g,""))
As Neil says, I suspect your problem might be a string mutability issue. Make sure you grab the return value from replace()
.
a source
to share