-3

It's not a question, simply an input to share my solution. In my script I have a regExp to replace url by blank character. In javascript this code works well but not in node js

var urlExp = new RegExp("(ht|f)tps?:\/\/\S*","gi");
var newString = myString.replace(urlExp, " ");

Every pattern, I tested works fine on https://regex101.com/#javascript. After many test with different RegExp pattern, I still have same issue. sometime the first url part is matched, sometine nothing matches.

Fabrice G
  • 273
  • 2
  • 5

1 Answers1

0

The solution is :

var urlExp = /(ht|f)tps?:\/\/\S*/gi;
var newString = myString.replace(urlExp, " ");

;)

Fabrice G
  • 273
  • 2
  • 5