JSFiddle - React, Tailwind, and code Playground

by jameshans

JavaScript

var someString = 'This is a nice little string with<a target="_" href="/carSale/12/..">link1</a>. But there is more that we want to do with this. Lets insert another <a target="_" href="/carSale/13/..">link2</a> ';

var regEx = /(<a.*>)(.*)(<\/a>)/;

var someArr = someString.match(regEx);

console.log(someArr[0]);
console.log(someArr[1]);
console.log(someArr[2]);
console.log(someArr[3]);