What does <br[^>]*> regex mean?
java, regex
Solution
Here's a full breakdown of the regex `<br[^>]*>`:
Match the characters `<br` literally
Match any character that is NOT a `>`
Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Match the character `>` literally
Also, you mentioned the regex `<br*>` in your post.
That would actually match `<b` and then it would match `r` 'between zero and unlimited times', followed by `>`.
Problem
I have seen this regex in html document parsing. I know that it matches `<br>` elements but i am not sure about `[^>]*>` part. As far as i understand the regex says that an element should start with "br" but why do they need `[^>]*>` part. Why did not they use `<br*>` ?