0
我需要更改marked.js
圖像表達式。更改marked.js圖像/鏈接表達式
原始表達式爲:/^\!?\[(inside)\]\(href\)(\w*\S*)*/
--->![]()
我需要獲得所有圖像的ID,所以我需要改造表達式中獲取價值,從這個---->{>"id"<}![inside](href)
ID。
我tryed改變表達是這樣的:/^\{\>index\>\}\!?\[(inside)\]\(href\)(\w*\S*)*/
而且塔爾後,我需要寫一個表達式得到的{>index<}![inside](href)
示例「指數」值內& HREF:
inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
inline._index = /(?:^\{\>[^\<\}]*\<\}|[^\{\>\<\}]|\<\}(?=[^\{\>]*\<\}))/; // I tryed this, but not works
//replacing
inline.link = replace(inline.link)
('inside', inline._inside)
('href', inline._href)
('index', inline._index)
();
任何人都可以幫助我建立這種表達?
暈! 非常感謝你,它是100%正確的! – 2015-04-05 23:13:01
你好,我只有一個問題,鏈接的[文本](http://example.com)'。 字符串示例: 原始正則表達式返回給我:'[「[text](http://example.com)」,「text」,「http://example.com」,未定義,索引:0,輸入:「[文本](http://example.com)和」]'之後。 使用該正則表達式.exec terurns:'[「[text](http://example.com)」,undefined,undefined,「text」,「http://example.com」,undefined,index:17,輸入:「在[text](http://example.com)之前和之後的一些文本]' 我需要在沒有」之前的一些文本「的情況下得到」輸入「,您能幫我解決嗎? – 2015-04-06 09:33:08
你能提供一個確切的輸入字符串嗎?我沒有在'[text](http://example.com)'中看到「輸入」,也沒有看到「之前的一些文字」。 – 2015-04-06 09:40:08