문제

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