I've tested this regex to extract URLs from a text string:
(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])
... and it works just as I'd like, it matches all the URLs I throw at it.
However, when I use REGEXEXTRACT in Google Sheets like this:
=iferror(Regexextract(A1,"(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])"),"")
... nothing extracts. The regex is identical.
What am I doing wrong?
NB. The Regex was tested here: http://www.regextester.com/53716

[-by[\-since-has special meaning in a character class, it's better to escape a dash in a character class. Unless it's at the end of the character class (in most regex engines)-has no special meaning if placed at the beginning or at the end of a character set.[-abc]or[abc-]are totally valid.httpetc "prefix" and then match any non-whitespace char?=REGEXEXTRACT(B6, "(?:(?:https?|ftps?|file)://|www\.|ftp\.)\S+")?