I need to match word boundaries using C++ Regex (ECMAscript or whatever), but in this particular situation I find myself, the criteria for what is considered a word-char must be changed.
By default, \w = [A-Za-z0-9_] and \W = [^\w].
But sometimes situations dictate that special chars like ?,!,,, etc also be considered word-chars.
Basically, I would be happy if \b was tricked into thinking that \w is \S and that \W is \s.
Is there a way to do it?
P.S. I'm currently trying to simulate this and expressions are looking ugly. Would be nice if I get \b to behave as I want. Also, it would be nice if the new definition of \b is only activated where I want, and at other places, the original definition of \b should be used.
Aucun commentaire:
Enregistrer un commentaire