Originally Posted by xelawho
seems to be OK. The code alert all the same words as the firefox inline spellchecker, which seems good enough. One thing, though - it seems the use of the \w makes the code think that café ends at "f" - any way around that one?
var x = "So: Théo, I wonder how I can remove (these brackets)... but not the é in café and/ or, \"this\" 'cool' apostrophe, [they're] co-terminous; (I believe!)."
x = x.replace(/\b[^\w\s\u00E0-\u00FC]+\B|\B[^\w\s]+\b/g, ""); // shorter alternative, do not delete accented characters at end of words
If you only want small letter e with acute é the Unicode is \u00E9. I don't think that there are any other accented characters which can appear at the end of a word in (imported) English except perhaps e with grave è which is \u00E8. Obviously many foreign languages use accented characters. In Italian è means is. You might perhaps want to retain La donna è mobile. My code covers all accented lower-case characters and hence all eventualities.
@Old Pedant - my understanding is that we are talking about dictionary words, not proper names. I don't see how any spell checker can check proper names. Some people even mis-spell Philip.
Is there a usually comma in the rendering of Wm. P. Norquist, III ?
@xelawoo - Might I repectfully suggest that you change your thread title to something more indicative of the content - such as "Regex to remove punctuation before/after dictionary words" which would perhaps be more helpful to people using the search feature of this forum.