I'm trying to create a Regex to filter out HTML opening tags in PHP
So far I came up with this pattern /\<[^/>]*\>/
.
This pattern seems to work on https://regexr.com/49vgk.
But as soon as I copy it into PHP I get this error:
PHP preg_match_all(): Unknown modifier '>'
PHP Code:
$input = '<p>This is my HTML text that I want <b>all</b> opening tags from</p>';
$regexPattern = '/\<[^/>]*\>/';
$openingTags = preg_match_all($regexPattern, $input);
So far I'm unable to figure out what is causing this issue. Mostly because I've escaped most characters.
Does someone in the StackOverflow community know what I'm doing wrong and if so could explain me what it is I'm doing wrong?
Thanks in advance.