I use this regex https://regex101.com/r/7Cw1fy/1
abc(\s*)(?![\S]+)
abc matches -> OK
abc cde matches -> not OK
>Solution :
You can use
abc(?!\s*\S)(\s*)
See the regex demo. Details:
abc– a fixed string(?!\s*\S)– a negative lookahead that fails the match if there are zero or more whitespaces followed with a whitespace immediately to the right of the current location(\s*)– Group 1: zero or more whitespaces.