سؤال

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