PHP validation/regex for URL

后端 未结 21 2098
青春惊慌失措
青春惊慌失措 2020-11-22 01:19

I\'ve been looking for a simple regex for URLs, does anybody have one handy that works well? I didn\'t find one with the zend framework validation classes and have seen sev

21条回答
  •  失恋的感觉
    2020-11-22 02:09

    I've found this to be the most useful for matching a URL..

    ^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$
    

提交回复
热议问题