• A. Coward (unregistered) in reply to Troche
    Troche:
    Christian:
    cBradley:
    As awesome as regular expressions are, they aren't taught in most Comp Sci programs.

    They're almost certainly taught in 99.999% of courses on compilers. Aren't compiler courses still taught in a majority of CS programs?

    One of the things I have run into is that, though it may be taught in CS programs it wasn't taught in my program. My degree is in CIS(Computer Information Systems), throwing that information systems in there evidently gave them license to just skip huge sections of my education.

    As an example my asp.net professor asked our class if we had ever had any asp experience before, when the entire class responded in the negative, he assured us that .net was just like asp and then proceeded to never teach anything about either .net or asp, the entire class was devoted to learning what an n-tier architecture was, and labs that couldn't be done because of the schools security policies.

    WTF-U alum class of 2006

    At my school there were two branches -- the CS degree program in the Mathematics department, and the MIS degree in the Business department. The Business department has no business teaching computers or programming IMHO.

  • s. (unregistered) in reply to tomanyregex
    tomanyregex:
    The ifs would actually perform faster and use less memory then the regex. And the if approach could have been simplified to evaluate one character at a time. But that doesn't matter. Sure regex make you look really smart, but that doesn't mean its better

    Actually, in most scripting languages (Perl, Python, PHP, Javascript) the regex of this class of complexity is equivalent to about 8 conditionals.

    The right regex would be /<br[^>]*?>/gi and in case of many occurences of it in the string, in most script languages it would be universally faster than iterating through all the occurences using a loop.

  • s. (unregistered) in reply to XIU

    <br it's cold> would be still treated as '
    ' with unknown parameters by the browsers.


    would too. Mostly anything is survivable between the < and >. One thing that could break the thing would be:

    <br <!-- style="clear:both" --> /> and that's illegal syntax, but we're talking HTML here, so there's no such thing as illegal HTML syntax in the real world.

  • s. (unregistered)

    oh, and another.

  • the voice of reason (unregistered)

    Oh, the confusion. Any program offering a 4-year degree in computer science should certainly be teaching that there is a theoretical construct known as a "regular expression", that one can be written to match any regular language, that there is an algorithm for producing one from a finite automaton, etc. A degree program will probably not teach you that there is a language feature found in perl and elsewhere that allows you to test whether or not a certain string matches a certain regular expression written in a more complicated language than the formal one described above.

  • Twey (unregistered)

    Y'know, technically in HTML
    should become
    >.

Leave a comment on “Breaking Broken”

Log In or post as a guest

Replying to comment #:

« Return to Article