My string being of the form:
"as.asd.sd fdsfs. dfsd d.sdfsd. sdfsdf sd .COM"
I only want to match against the last segment of whitespace before the last period(.)
So far I am able to capture whitespace but not the very last occurrence using:
\s+(?=\.\w)
How can I make it less greedy?
You can try like so:
(\s+)(?=\.[^.]+$)
(?=\.[^.]+$)
Positive look ahead for a dot and characters except dot at the end of line.
Demo: