my $pod2html = qr/ ([BUI]) # start of formatting pattern (<+) # collect opening braces \s*(.*?)\s* # collect text, without border space (??{'>' x length($2)}) # match same number of closing braces /x;