Is it possible (maybe using RegExp or something else) to do the following with less code?
var bTest = szNextEntity[0] == '<' && szNextEntity[1] != '/'
So bTest is true if the zeroth character of szNextEntity == '<' and the first character != '/'
Am interested in how concise this can be made.
Thanks.
You could use a little regex to test the string. But in general, using regex to parse HTML is a bad idea.
Even Jon Skeet cannot parse HTML using regular expressions. Every time you attempt to parse HTML with regular expressions, the unholy child weeps the blood of virgins, and Russian hackers pwn your webapp. Parsing HTML with regex summons tainted souls into the realm of the living. HTML and regex go together like love, marriage, and ritual infanticide.
var re = /^<[^\/]/;
var str1 = '</end tag>';
var str2 = '<start tag>';
console.log(re.test(str1));
console.log(re.test(str2));