sub is_all_in_bold { my $title=shift; my ($title_content)=$title=~m!(.*?)!s; 1 while $title_content=~s#(?:[^<>]+|(?!).)*##s; print "$title_content\n"; return !$title_content; } while () { print; chomp; next unless /\S/; print is_all_in_bold($_) ? "Its all in bold\n" : "Its not all in bold\n"; } __END__ <b>Meta‐Ethics and The Problem of Creeping Minimalism</b> Meta‐Ethics and <b>The Problem of Creeping</b> <b>Minimalism</b> <b>foo<b>bar</b></b>