This regex (Regular expression) find all words or group of word who begin with capital letter. But is should exclude words after a dot followed by a space and a word who begin by a capital letters: I.E. it will exclude Hello because a dot and space are preceding the word Hello ". Hello you".
The goal is to replace in a text all included word from the regex by a href link but will exclude ". Any word beginning with Cap letter". It look like:
// EXCLUDE: (. Hello) dot and space precede the capital word )
const regex = /\b((?!\.[\s]+)(?:[A-Z][\p{L}0-9-_]+)(?:\s+[A-Z][\p{L}0-9-_]+)*)\b/ug;
const subst = '<a href="#">$1</a>';
I though that (?!\.[\s]+) should do the trick but it's not.
Here a test on regex101: https://regex101.com/r/nwyL8I/3
Thank you.
\b(?<!\.\s+)((?:\p{Lu}[\p{L}0-9_-]+)(?:\s+\p{Lu}[\p{L}0-9_-]+)*)\b, see this demo