(Jun-08-2020, 05:49 AM)goodsignal Wrote: re.search() will return the extent of the pattern match, which could be a sub-string of the input.
Basically, yes. Technically, it returns a match object, which includes the start/end/span and any capturing groups (among other things).
Quote:re.sub() will return the entire input, only replacing the portion that matches the regex pattern.
Yup. (And by default, the replacement can happen multiple times. While re.search() will only match the leftmost position).