EasyRegex Logo
EasyRegex
Nouveau

Detect <br> tags at the beginning of a string in JavaScript

Javascript

Expression Régulière

^(<br>)+
Copier
Avez-vous des Retours ?

Explication

This regex pattern matches one or more occurrences of the '<br>' tag at the beginning of a string. '^' asserts the position at the start of the string. '<br>' matches the literal '<br>' tag. '+' matches one or more occurrences of the preceding element. The use of parentheses and the '+' quantifier ensures that it captures and matches multiple '<br>' tags at the beginning of the string.

Javascript

Exemple d'Utilisation

const regex = /^(<br>)+;
const str = '<br><br>Hello, <br>World';
const matches = str.match(regex);
console.log(matches);
Copier
Testez l'expression

Expressions Régulières Similaires