I've found and want to use the following pattern ((ht|f)tp(s?)\:\/\/|~\/|\/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((\/?\w+\/)+|\/?)(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?
Regular expressions 101 considers it a valid regex for javascript.
Yet when I try to use it in my ng-pattern it throws the following error:
SyntaxError: Invalid regular expression: /^((ht|f)tp(s?)://|~/|/)?([w]+:w+@)?([a-zA-Z]{1}([w-]+.)+([w]{2,5}))(:[d]{1,5})?((/?w+/)+|/?)(w+.[w]{3,4})?((?w+=w+)?(&w+=w+)*)?$/: Invalid group
at new RegExp (native)
The exact way I'm implementing this is that I've defined the pattern in a configs file and then I'm loading it into the controller from which it is passed into the ng-pattern
.