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

有帮助吗?

解决方案

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+$
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top