Question

I've an issue in validating string with regular expression in IE 6. The pattern for link is as follows:

(?=^\S*$)(?=((http|https):\/\/.+))

It works correctly in IE 8, FF, Chrome, but fails in IE 6.

For example, the string "http://google.com" doesn't match the pattern only in IE 6. Looking for the answer I've found articles of IE6 regex bugs connected with the use of lookaheads, but didn't catch whether my case suits it also.

Thanks in advance

Was it helpful?

Solution

If it doesn't match, then yes, that's a bug. However, the regex itself is very weird. You'd get the same result with

(?=^https?:\/\/\S+$)

or, since you don't need a lookahead at all here:

^https?:\/\/\S+$
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top