const regex = /url\('[\.]{2}\//g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('url\\(\'[\\.]{2}\\\/', 'g')
const str = `@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.1.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff?v=4.1.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.1.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal} .preview .fa{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} .preview .fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%} .preview .fa-2x{font-size:2em} .preview .fa-3x{font-size:3em} .preview .fa-4x{font-size:4em} .preview .fa-5x{font-size:5em} .preview .fa-fw{width:1.28571429em;text-align:center} .preview .fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none} .preview .fa-ul>li{position:relative`;
const subst = `url(//en.wikipedia.org/${1})`;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions