By the way, what I'm trying to do is to parse string patterns like `[href]' and `[href text]'. And as you can realize from :START 13 keyword, I'm previously determined that at 13th character, there exists a `['. Do you suggest any other method to parse such strings more efficiently?
A regex seems like a fine way to me.
Next time, how can I understand when a regex will need that much backtracking? I'll be really appreciated if you'd explain the pattern a little bit more.
You can play around with the Regex Coach http://weitz.de/regex-coach/ and step through the matching. If you really want a deeper understanding Jeffrey Friedl's Mastering Regular Expressions is very good. And most compiler text books will cover regexs as well.
Maybe someone else has a simple backtracking explanation.
Cheers, Chris Dean