The (?<=\ ).*?com(?=\.)
pattern matches a location after a space, then matches any 0 or more chars other than line break chars but as few as possible up to the first occurrence of com
followed with a dot. So, it will match any amount of spaces on its way from the matched location after space to the com.
substring.
If com
can be anywhere inside the word you may use either of the two expressions below:
[^\s.]*com[^\s.]*\.
\w*com\w*\.
and replace with a .
.
Or, equivalent:
[^\s.]*com[^\s.]*(?=\.)
\w*com\w*(?=\.)
and replace with an empty string.
If the com
must be at the end of the word, just remove the second [^\s.]*
/ \w*
from the above expressions.
Details
[^\s.]*com[^\s.]*\.
- matches 0+ chars other than whitespace and .
, then com
and then again 0+ chars other than whitespace and .
and a .
\w*com\w*\.
- matches 0+ letters/digits/_
, then com
, then again 0+ letters/digits/_
and then .
.
Notepad++ demo and settings:
