i want to replace the “.” into tokens like [dot] from below input to below output
input
this is a test.for a question. at stackoverflow.com the best place to learn. programming. test http://www.wikipedia.com
output
this is a test.for a question. at stackoverflow[dot]com the best place to learn. programming. test www[dot]wikipedia[dot]com
problems
- there is a possibly
test.forwe cant use good regex like/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}/gii think its best for using something like below better - maybe i found a solution;
found = string.match(/([a-zA-Z0-9]+\.(com|co\.cc)|more\.domains)/gi);
this work great, i have a problem to join/replace them to the original string. any workarounds like how can we filter elements in array with regex in array with javascript?
how would you tackle this problem? btw im using nodejs other language is acceptable.
thanks
This handles
www.example.comcorrectly: