Created
June 14, 2018 23:51
-
-
Save RatoX/07525eef1cf0f5e3de82eef59b939893 to your computer and use it in GitHub Desktop.
Regex to match tags content with multiple lines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const str = 'Ola como vai <b>voce?\n Eu vou</b> <b>bem</b>' | |
str.replace(/<b>(.*?|[\s\S]*?)<\/b>/g, '**$1**') | |
// Result: "Ola como vai **voce?\n Eu vou** **bem**" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assim vai funcionar com qualquer tipo de tag.