javascript regex: `foo` -> **foo**? -
basically, hack markdown engine own website.
now, i'm trying convert string wrapped single `
`foo`
to
**foo**
using regex
, far, can think of
var data = data0.replace(/`.*`/g, '...');
and obviously, not work intend.
and markdown has
``` ```
format, , want untouched- exclude regex match.
can advise regex be?
thank you.
this attempt @ simple, clean regex:
regex string
`\b(.*?)\b`(?!`)
replace string
**$1**
online demonstration
Comments
Post a Comment