I have a large static result and I'm trying the following changes:
- Replace the original domain to another one.
- Convert url's hash to url with parameters using the post id only for a specific domain (website.com).
This is my original static result example with 3 links and 2 differents domain names:
var json = {This is the static result with many links like this <a href=\"http://website.com/932427/post/something-else/\" target=\"_blank\"> and this is other link obviusly with another post id <a href=\"http://website.com/456543/post/another-something-else/\" target=\"_blank\">, this is another reference from another domain <a href=\"http://onother-website.com/23423/post/please-ingnore-this-domain/\" target=\"_blank\"> }
So, the originals url's I need to change are two, according with the above example:
http://website.com/932427/post/something-else/
http://website.com/456542/post/another-something-else/
And I want to change that links now with this format:
http://other_domain.com/id?=932427/
http://other_domain.com/id?=456543/
And the final result should look like this into the static result.
By the way I'm using node.js
Thanks in advance
jsondoes not look like real JSON. Take a look at regular expressions (developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/…). You'll then be able to find required links and replace/reformat them in a certain way you need it.