I need some help
My pattern looks like
/°>(http|\/)([^|<]+?)(?!\.gif|\.jpg|\.mp|\.png|\.jpeg)<°/gi
I have 4 examples for what I try to achieve:
°>/w NICK<°
$1 -> /
$2 -> w NICK
°>http://google.de<°
$1 http $2 ://google.de
°>/w NICK|/w NICK<°
no matches because of the |
°>http://google.de/img.png<°
no matches because of ending with .png
Now im totally clueless.... iI got the regex for the first 3 examples working, but can't get the lookahead for ending with a img extension in c# i got it working but not for javascript
Use
°>(http|\/)(?![^|<]*\.(?:gif|jpe?g|mp|png)<)([^|<]+)<°
See the regex demo
Details :
°>
- a literal substring (http|\\/)
- Group 1: http
or /
(?![^|<]*\\.(?:gif|jpe?g|mp|png)<)
- a negative lookahead that fails the match if, immediately after http
or /
, there are 0+ chars other than |
and <
followed with some extensions specified in the non-capturing group that are followed with <
([^|<]+)
- Group 2 matching 1 or more chars other than |
and <
<°
- a literal substring.
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.