How to find <b> followed by another <b> without a closing </b>?

How to find <b> followed by another <b> without a closing </b>?

8

    Mar 20, 2023#1

    I have a file where there are sometimes a <b> tag (bold) and before it is closed with a </b> there is another <b>, e.g.:

    <RF><b>1:4 <b>Hom wat is ... kom:</b> 

    The second <b> should not be there.

    Is it possible to write a regex pattern to find such occurrences?

    18672
    MasterMaster
    18672

      Mar 20, 2023#2

      Hi, nested <b> tags are not allowed? In other words - is it enough to test a pattern <b>....<b>....</b> because there are no patterns <b>...<b>...</b>...</b>?

      EDIT: the text inside <b>...<b> can contain more lines? And the tag <RF> before the first <b> is mandatory?

      Thanks, Fleggy

      6,603548
      Grand MasterGrand Master
      6,603548

        Mar 20, 2023#3

        A bold tag can contain nested another bold formatting tag according to HTML. It is possible with CSS that the text in inner bold element is formatted different than the text in outer bold element.

        However, in general a bold element is not nested inside a bold element. HTML Tidy outputs a warning on doing that. There are output two warnings by HTML Tidy for the example above:
        HTML Tidy wrote:Warning: nested emphasis <b>
        Warning: missing </b> before </p>
        A bold element must have a start and an end tag.

        There could be used the Perl regular expression (?s)<b\>[^>]*?>(?:(?!</b\>).)*?<b\> to find a start bold tag with a missing end bold tag or an erroneous start bold tag inside a bold element, i.e. two start bold tags without an end bold tag between.
        Best regards from an UC/UE/UES for Windows user from Austria