I need to match a word with a French character (dérange
) with a regular expression. So far I have this:
var text = "An inconvenient (qui dérange) truth";
var splitText = text.trim().match(/\w+|\s+|[^\s\w]+/g);
console.log(splitText);
However, it treats the é
as a separate letter. Why?
I need a regex within the match()
method so that the splitText
object also contains the word déranger
and not the three words d
, é
and range
as it does now.