jquery - Replace all content between characters with JavaScript -
I am trying to create a simple markdown converter for getting better at JS and Regex.
I now need to find everything between two asterisks, and they RESULT: I also answer a related question, but I am unsure about how to adjust my code accordingly, or what it really is: Any help would be great. Get content wrapped in HTML tags: So then & lt; I & gt; Wrap the tag:
var html = '* abc wire *'; Var html = html.replace (/ \ * / g, ' gt;'); Console.log (html);
& lt; I & gt; ABC is a string & lt; I & gt;
(? S) & lt; H1>. & Lt; / H1>
Var html = html.replace (/ \ * ([^ *] +) \ * / g, ' $ 1 & lt; / i & gt;'); Explanation of
([^ *] +) :
(# Start of Capture group [^ # Start of denial]
[^ *] + means "at least one letter that matches the
* is not. It has the effect that all the characters from next to
* are matched.
Comments
Post a Comment