Br /illiant XHTML Converter



  • To make your documents XHTML conforming, you need to turn <br> into <br />, right? No problem! Just replace all instances of br by br /. Now your page explaining what br /owsers do to deal with br /ute-force attacks is ready for the future!

     

    As seen on http://www.softed.de/fachthema/https.aspx (German).



  • [Obligatory br /illant correction]

    Interesting that it looks like the German language generally doesn't include the "br" letter combination. In a rudimentary sweep of the site, it looks like it's only found in English words like browser and brute.



  •  @RHuckster said:

    [Obligatory br /illant correction]

    Interesting that it looks like the German language generally doesn't include the "br" letter combination. In a rudimentary sweep of the site, it looks like it's only found in English words like browser and brute.

    It's a coincindence. Brücke, bringen, brauchen, brechen, brauen and many more, compositions of 'ab' with words beginning with an 'r', abrunden, abrechnen, ... it's not as frequent as 'ng', but a very common combination. Quite remarkable that none of those words seems to appear on that page.



  •  Well, the header of the page looks like this:

    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"
    xmlns:o="urn:schemas-microsoft-com:office:office">

    So I'm not really surprised.



  • Clbuttic.

    And today, class, we use a real-world example to learn why regexes can be more useful than find/replace. Today's lecture is entitled: "Leaning toothpick syndrome".



  • @Ilya Ehrenburg said:

    Quite remarkable that none of those words seems to appear on that page.
    What do you mean 'fix the bug?' We implemented a workaround for the user.



  • I made my own clbuttic mistake today, but it wouldn't compile, so it wasn't much of an issue.  I explained concept of "clbuttic" to the indian woman I was working with at the time, and she told me about how her friend, Shitka, has trouble getting her name through certain filters intact.



  • @HighlyPaidContractor said:

    I made my own clbuttic mistake today, but it wouldn't compile, so it wasn't much of an issue.  I explained concept of "clbuttic" to the indian woman I was working with at the time, and she told me about how her friend, Shitka, has trouble getting her name through certain filters intact.

     

    More awesome if her last name happens to start with an N.

    Shitka N.



  • @Theodor said:

    To make your documents XHTML conforming, you need to turn <br> into <br />, right?

    Oh, but there's so much more!

    Seriously, what's the point in using XHTML if not to brag with XHTML conformity, which they failed to achieve?



  • @jpaull said:

    More awesome if her last name happens to start with an N.

    Shitka N.

    Cool story, br /o.


  • Does anybody still give a shit about XHTML anymore? I thought HTML5 was the new "markup language of the future".



  • @MiffTheFox said:

    Does anybody still give a shit about XHTML anymore? I thought HTML5 was the new "markup language of the future".

    Did anybody ever give a shit about it?

    It's hard to think of a bigger waste of time than HTML5 in the web development industry...



  • @derula said:

    @jpaull said:

    More awesome if her last name happens to start with an N.

    Shitka N.

    Cool story, br /o.

    +1



  • @RichP said:

    And today, class, we use a real-world example to learn why regexes can be more useful than find/replace.

    You don't really need a regex to replace <br> with <br />.



  • @Daniel15 said:

    @RichP said:
    And today, class, we use a real-world example to learn why regexes can be more useful than find/replace.

    You don't really need a regex to replace <br> with <br />.

    I agree. Whatever is wrong with (pseudocode): text.replace("<br>", "<br />");
    text.replace("<br >", "<br />");
    text.replace("<br  >", "<br />");
    text.replace("<br   >", "<br />");
    text.replace("<br    >", "<br />");
    text.replace("<br class=\"my-special-break\">", "<br class=\"my-special-break\" />");
    text.replace("<BR>", "<br />");
    text.replace("<BR >", "<br />");
    text.replace("<BR  >", "<br />");
    text.replace("<BR   >", "<br />");
    text.replace("<BR    >", "<br />");
    text.replace("<BR class=\"my-special-break\">", "<br class=\"my-special-break\" />");

    I mean, that's way easier and obviously more complete than text.replace(/<br( [^>]*)?>/i, "<br\1 />");.



  • @derula said:

    @Daniel15 said:
    @RichP said:
    And today, class, we use a real-world example to learn why regexes can be more useful than find/replace.

    You don't really need a regex to replace <br> with <br />.

    I agree. Whatever is wrong with (pseudocode): text.replace("<br>", "<br />");
    text.replace("<br >", "<br />");
    text.replace("<br  >", "<br />");
    text.replace("<br   >", "<br />");
    text.replace("<br    >", "<br />");
    text.replace("<br class=\"my-special-break\">", "<br class=\"my-special-break\" />");
    text.replace("<BR>", "<br />");
    text.replace("<BR >", "<br />");
    text.replace("<BR  >", "<br />");
    text.replace("<BR   >", "<br />");
    text.replace("<BR    >", "<br />");
    text.replace("<BR class=\"my-special-break\">", "<br class=\"my-special-break\" />");

    I mean, that's way easier and obviously more complete than text.replace(/<br( [^>]*)?>/i, "<br\1 />");.

    
    var text = "<br />";
    
    var replacedText = text.replace(/<br( [^>]*)?>/i, "<br\\1 />");
    
    alert(replacedText);
    
    


  • @derula said:

    I mean, that's way easier and obviously more complete than text.replace(/<br( [^>]*)?>/i, "<br\1 />");.


    <br title="foo>bar" />



  • @Buzer said:

    <br title="foo>bar" />
     

    No sane person is going to put those literal characters in an attribute.



  • @dhromed said:

    No sane person is going to put those literal characters in an attribute.

    Sane? If all people were sane, this website wouldn't even exist.



  • I never said my regex is correct or complete, only that it matches some more cases than the chain of replaces... to show that there are cases in which simple find/replace isn't enough. To do it 100% accurate, you'd probably need an XML parser (at least a partial HTML parser). Or lots of patience.



  • @derula said:

    I never said my regex is correct or complete, only that it matches some more cases than the chain of replaces... to show that there are cases in which simple find/replace isn't enough. To do it 100% accurate, you'd probably need an XML parser (at least a partial HTML parser). Or lots of patience.

    Yeah, but if I acknowledged that, I couldn't make a smartass post that shows off what a 1337 c0d3r I am.



  • @derula said:

    I never said my regex is correct or complete, only that it matches some more cases than the chain of replaces... to show that there are cases in which simple find/replace isn't enough. To do it 100% accurate, you'd probably need an XML parser (at least a partial HTML parser). Or lots of patience.

    The object is to turn it into well-formed XML. If you can run it through an XML parser, it already is!



  • @ThePants999 said:

    The object is to turn it into well-formed XML. If you can run it through an XML parser, it already is!

    Pedantic DickWeed


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.