javascript - change marked.js image/link expression -



javascript - change marked.js image/link expression -

i need alter marked.js image expression.

the original look is: /^\!?\[(inside)\]\(href\)(\w*\s*)*/ ---> ![]()

i need id of images, need transform look id value ----> {>"id"<}![inside](href).

i tryed alter look this: /^\{\>index\>\}\!?\[(inside)\]\(href\)(\w*\s*)*/

and after thar need write look "index" value of {>index<}![inside](href)

examples within & href:

inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/; inline._href = /\s*<?([\s\s]*?)>?(?:\s+['"]([\s\s]*?)['"])?\s*/; inline._index = /(?:^\{\>[^\<\}]*\<\}|[^\{\>\<\}]|\<\}(?=[^\{\>]*\<\}))/; // tryed this, not works //replacing inline.link = replace(inline.link) ('inside', inline._inside) ('href', inline._href) ('index', inline._index) ();

anyone can help me build expression?

if right, want obtain info link has specific format, e.g. {>"id"<}![inside](href)and_the_rest.

so, best regex can suggest moment can {>([^<]*)<}\!?\[([^]]+)\]\(([^)]*)\)(\w*\s*)*. assumes have "id" within > , <, "inside" within [ , ], , "href" within ( , ) 1 right after another.

class="snippet-code-js lang-js prettyprint-override">function findvalues(str) { var re = /\{\>([^<]*)\<\}\!?\[([^\]]+)\]\(([^\)]*)\)(\w*\s*)*/; var m; if ((m = re.exec(str)) !== null) { homecoming [m[1], m[2], m[3], m[4]]; } } var vls = findvalues('{>"id"<}![inside](href)and_the_rest'); document.getelementbyid('id').innerhtml = "id: " +vls[0] + "<br>inside: " + vls[1] + "<br>href: " + vls[2] + "<br>rest: " + vls[3]; class="snippet-code-html lang-html prettyprint-override"><div id='id'/>

javascript regex markdown codemirror

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -