Skip to content

Commit

Permalink
fix: remove captured group redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
dukenv0307 committed May 5, 2023
1 parent 9dfb2cb commit d3c1d6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ExpensiMark.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ export default class ExpensiMark {
* Use [\s\S]* instead of .* to match newline
*/
name: 'italic',
regex: /(?!_blank")([^\W_]?)_((?![\s_])[\s\S]*?[^\s_])_(?![^\W_])(?![^<]*(<\/pre>|<\/code>|<\/a>|_blank))/g,
replacement: (match, g1, g2) => (g1 || (g2 && g2.includes('<pre>')) ? match : `<em>${g2}</em>`),
regex: /(?!_blank")[^\W_]?_((?![\s_])[\s\S]*?[^\s_])_(?![^\W_])(?![^<]*(<\/pre>|<\/code>|<\/a>|_blank))/g,
replacement: (match, g1) => (g1.includes('<pre>') ? match : `<em>${g1}</em>`),
},
{
// Use \B in this case because \b doesn't match * or ~.
Expand Down

0 comments on commit d3c1d6e

Please sign in to comment.