I have a page that displays the user's IP address, I can't edit the code as it is encoded, so I'm just making edits in smarty templates. I'm trying to using regex to hide the user's IP address that shown on that page.
Here is the code I have but its not working:
$('div#container').text(function (i, t) {
return t.replace(new RegExp("\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b", 'gi'), '');
})
I tried more that one regex format found in this question.
If I directly inserted my IP, it works and hide it, however if I used regex format instead, it won't work.
I'd greatly appreciate it if anyone could shed some light on this. Thank you so much.