EasyRegex

New

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

Javascript

Regular Expression

^(<br>)+
Copy
Do you have Feedback?

Explanation

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

Example Usage

const regex = /^(<br>)+;
const str = '<br><br>Hello, <br>World';
const matches = str.match(regex);
console.log(matches);
Copy
Test the expression

Similar Regular Expressions