1 | /\s0(1+)/ matches "white space", followed by zero and 1 or more ones -- the set of ones is stored in \1 ( $1) |
2 | /[0-9]\.0\D/ matches "the answer is 1.0 exactly" but not "The answer is 1.00". |
3 | In first case $` is "the answer is ", $& is "1.0 " and $' is "exactly" |
4 | /a.*c.*d/ matches "axxxxcxxxxcdxxxxd" with $` and $' as null and $& as full string |
5 | /(a.*b)c.*d/ matches "axxxxbcxxxxbd" with |
6 | \1 as "axxxxb" -- note backtracking as greedy (a.*b) first matches to "axxxxbcxxxxb" but then tries again when following c.*d fails to match |