in reply to Re: Regex within html
in thread Regex within html

Thanks for assist Moritz

Im not sure how you would 'tokenize' it in the first place ? would that not have a regex as well ?

Its also worth commenting this isnt about a templating system, the raw html is generated by another host (which I have no control over) and just have that to work with ?

Replies are listed 'Best First'.
Re^3: Regex within html
by moritz (Cardinal) on Sep 08, 2008 at 13:08 UTC
    Im not sure how you would 'tokenize' it in the first place ? would that not have a regex as well ?

    It sure would, but the point is that it would need one regexp per possible token type, not one huge regex that solves the whole problem.

    Usually I use the tokenizer from Math::Expression::Evaluator::Lexer (don't let the name fool you; it's good for more than mathematical expressions), from which you could draw inspiration.

    And don't use .* in your regexes, that's almost always an error. See Death to Dot Star!.

Re^3: Regex within html
by Anonymous Monk on Sep 08, 2008 at 12:43 UTC