简体   繁体   中英

regular expression for string that starts with 'http://'

大家好,就像标题中一样-我需要使用匹配以'http://'开头的任何内容的正则表达式

Is that really what you want?

This will match everything up to the first whitespace: ^http://[^\\s]*

Why not just look to see if the first 7 characters are "http://"

substr($url, 0, 7) == "http://"

No need for regexps here.

这应该做到这一点: ^http://.*

所以从根本上讲,您想匹配字符串中的URL吗?

http://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM