Similarly, only when <a> and not when <a ?
Parsing characters can be done, and indeed already is.
But there is a wide range between “don’t parse anything” and “parse everything that could possibly be there”.
for a contrived example
if(count<a){
if((amount=="all")&&(time>24)){
you wouldn’t want to get a link like <a){ if((amount=="all")&&(time>
In other words, regular expressions and conditional testing could be used, but having enough code in place to deal with everything would be extreme.
What is most commonly done is what is done here. a compromise. Be it bbCode, Handlebars, HTML MarkDown, i.e.
As long as the text is entered in a certain format it will be parsed.
When something is not in a certain format when it should be, and when it shouldn’t be but is, that’s when there’s a problem.