Perhaps because the regular expression is written in PCRE syntax. See if you have (or can install) the pcregrep program on your system β it has the same syntax as grep , but accepts Perl-compatible regular expressions β and you should be able to do this.
Another option is to try the -P version of grep , but the manual page says that it is "very experimental", so it may or may not work.
I will say that you should carefully consider whether it is really advisable to use this or any regular expression to validate the URL. If you want to have the correct check, you probably would be better off finding or writing a small script, such as Perl, to use the tools for checking the language url.
EDIT . In response to your editing in the question, I did not notice that this regular expression also acts in the syntax "advanced". I donβt think you can get better / faster.
David z
source share