Need regex to match links like www.example.com
in an html/text
-string but:
"www. some text after"
"www" only such as "some text before www some text after"
http
\\s
) or not character before such as: " www.example.com"
or "www.example.com"
I tried with:
'/(^|\s)(www[^\s].[^<> \n\r \s]+)/iex'
but also match "www. some text after"
You were looking for
/(^|\s)(www[^<>\s]+)/
\\s
includes \\n
, \\r
You can also use (?<=^|\\s)(www\\.[^<>\\s.]+\\.[^<>\\s.]+)(?=\\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.