3 ms·
Not quite. This works: (?:(?!>).)*>? But that is a very long winded way of writing: [^>]*?> which is long way of writing: [^>]*>
by rstuart4133 6y ago
Not quite. This works:
(?:(?!>).)*>?
But that is a very long winded way of writing:
[^>]*?>
which is long way of writing:
[^>]*>
- Jenk 6y agoI was missing the trailing > in my pattern but you are still right (as is the article) It's been fun to note the benchmarks: all tested against the string: <a href="sdfsdf">sefsefsefsef</a> 1. (?!>).*?> 2 matches, 41 steps 2. (?:(?!>).)*>? 3 matches, 142 steps 3. (typo?) (?:(?!>).)*?> 2 matches, 161 steps 4. [^>]*?> 2 matches, 6 steps 5. [^>]*> 2 matches, 6 steps