Modifying text 1, the replacement expression in Perl is: $ VAR = ~ s / regex / replacement / can use $ 1 variable in Replacement
2, in Perl <> means a line of text
3, Definded ($ VAL) Viewing a variable is defined
4, Lookaround: Location ID, positioning to match the text location before or after Lookahead: (? = ...) Lookback (positioning): (? <= ...)
5, / g Options represents Global Replacement, all replacement
6, S / (? <= / Bjeff) (? = S / B) / '/ g Search for a position, this location is jeff, behind is S, then add' in this position
7, s / (? = S / b) (? <= / B jeff) / '/ g and s / (? <= / Bjeff) (? = S / b) /' / g expressed the same location
8, add a comma to the whole three, such as 123456789 becomes 123, 456, 789 $ POP = ~ S / (? <= / D) (? = (/ D / d) $) /, / g; or (? <= / d) (? = (?: / d / d / d $) where (?: ...) indicates that do not participate in sub-match, more efficient, but relatively complicated is difficult to understand $ pop = ~ S / (? <= / d) (? = (/ d / d) (?! / d)) /, / g; it is correct, halo. The reason is $, so use Negative Lookahead to replace
9, four cases of position matching: Type Regex successful if the enclosed substexpression.. .Positive lookbehind (? <= ...) Successful if can match to the leftnegative lookbehind (?