03/01/2025JS

Liste de regex

Email

const emailRegex = /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$/
emailRegex.test('[email protected]') // true

<retrieveThisText>

regex = /(?<=<)(.*)(?=>)/gm
'<text>'.match(regex)[0] // text

HTML to string

const htmlToString = (content) => content.replace(/<[^>]+>/g, '');