Rewrite regex without negation

不想你离开。 提交于 2019-12-06 11:16:53

Try this regex:

https?:[^:]*$

Regex live here.

The lookaheads exist for a reason.

However, if you insist on a supposedly equivalent alternative, a general strategy you can use is:

(?!xyz)

is somewhat equivalent to:

$|[^x]|x(?:[^y]|$)|xy(?:[^z]|$)

With that said, hopefully I didn't make any mistakes:

https?:\/\/(?:$|(?:[^h]|$)|(?:h(?:[^t]|$))|(?:ht(?:[^t]|$))|(?:htt(?:[^p]|$))|(?:http(?:[^s:]|$))|(?:https?(?:[^:]|$))|(?:https?:(?:[^\/]|$))|(?:https?:\/(?:[^\/]|$)))*$
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!