Aug-14-2020, 04:35 PM
Lazy regex "\S+?@" will consume the minimum number of characters until it reaches a white space character or until it reaches a character matching the subsequent character "@". In effect, it will start at the beginning of a character string that is not interrupted by white space and stop when it finds "@". Without the laziness, the regex engine might consume the "@" as part of "\S".
The lazy regex at the end only consumes a single character because that's all the engine needs to satisfy the regex.
The lazy regex at the end only consumes a single character because that's all the engine needs to satisfy the regex.