\\b${urls.DOMAIN}/joinchat\\b this is my regexp this give me exac match but i want full…
- User
\\b${urls.DOMAIN}/joinchat\\bthis is my regexp this give me exac match but i want full word of exac word Assistant
It seems like you're trying to match the exact word of your domain in a larger text using regular expressions. The
\bword boundary metacharacter you're using should indeed match the exact word, not a part of a word. However, if you want to match the full word including any preceding or following non-word characters (like punctuation, spaces, etc.), you can modify your regex slightly.Here's an example:
regex(?<=\\s|\\W)\\b${urls.DOMAIN}/joinchat\\b(?=\\s|\\W|$)This will match the exact word
urls.DOMAIN/joinchatand also include any non-word character that comes before or after it in the match.(?<=\\s|\\W)is a positive lookbehind that matches a whitespace character or a non-word character before your domain.(?=\\s|\\W|$)is a positive lookahead that matches a whitespace character, a non-word character, or the end of the line after your domain.
- User
not work
Assistant
I apologize for the confusion. Let's try a different approach:
regex(?:^|[^\\w])(${urls.DOMAIN}/joinchat)(?:$|[^\\w])This pattern uses non-capturing groups
(?:...)and negative character classes[^...]to match the exact wordurls.DOMAIN/joinchatand also include any non-word character that comes before or after it in the match.(?:^|[^\\w])matches the start of the line or a non-word character before your domain.(${urls.DOMAIN}/joinchat)matches your domain.(?:$|[^\\w])matches the end of the line or a non-word character after your domain.