Anyway, if I work with a more complex table in which only particular cells (in whatever column) will include LTR words that need to be rendered as a' instead of 'a then must I still use CSS or is there some JavaScript technique to render them that way?
If needed, I’d bet there isn’t but still asking…
CSS doesnt do regex. It also doesn’t match on text content, it’s selecting the element based on the attributes of the node.
There’s not such thing as “strictly match English letters”. There’s not a thing such as “English letters”.
A “T” is not an english letter - it is a letter used by many languages.
English includes (though admittedly its rarely used) uses of diaeresis that are entirely of the english language’s design: ex: naïve
English also loanwords words with diacritical markings.
So… your “english” word selector would have to account for loanwords and diaeresis. And when you include those you… end up back where you started for the most part. Everything that uses a descendant of the Latin alphabet.
shrug
Javascript could use a RegEx to apply a style to a table cell. You’d have to determine what qualifies for the regex though. (What if the first character’s a number?)
I stuck with CSS because you posted in the HTML & CSS forum.
Paul’s code is… functionally good… as long as you dont end up using a multiple letter combination of a-zA-Z in the middle of a non-LTR word or phrase… I dont know what OP’s requirements are specifically, so…
My requirement here is to loop through an entire table that contains cells with phrases in various languages and to set an attribute to each cell that contains a phrase starting with a letter of the English alphabet.