[英]how to capture the string that beginning and ending certain kind of string with Regex in javascript
[英]Regex Replace with Capture not ending with String
我需要協助
我的圖案看起來像
/°>(http|\/)([^|<]+?)(?!\.gif|\.jpg|\.mp|\.png|\.jpeg)<°/gi
對於要實現的目標,我有4個示例:
°>/w NICK<°
$ 1-> /
$ 2-> w NICK
°>http://google.de<°
$ 1 http $ 2://google.de
°>/w NICK|/w NICK<°
由於|而沒有匹配項
°>http://google.de/img.png<°
由於以.png結尾而沒有匹配項
現在我完全不知道了。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
采用
°>(http|\/)(?![^|<]*\.(?:gif|jpe?g|mp|png)<)([^|<]+)<°
詳細資料 :
°>
-文字子字符串 (http|\\/)
-第1組: http
或/
(?![^|<]*\\.(?:gif|jpe?g|mp|png)<)
-失敗比賽如果,之后立即負先行http
或/
,還有比其他0+字符|
和<
后跟非捕獲組中指定的某些擴展名,后跟<
([^|<]+)
-組2匹配1個或多個除|
以外的字符 和<
<°
-文字子字符串。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.