s/\.\K[^.]*$/txt/; #### Compiling REx "(?<=[.])[^.]*$" Final program: 1: IFMATCH[-1] (7) 3: EXACT <.> (5) 5: SUCCEED (0) 6: TAIL (7) 7: STAR (19) 8: ANYOF[\0-\-/-\377{unicode_all}] (0) 19: EOL (20) 20: END (0) floating ""$ at 0..2147483647 (checking floating) minlen 0 Guessing start of match in sv for REx "(?<=[.])[^.]*$" against "xyz.foo" Found floating substr ""$ at offset 7... Guessed: match at offset 0 Matching REx "(?<=[.])[^.]*$" against "xyz.foo" 0 <> | 1:IFMATCH[-1](7) failed... 1 | 1:IFMATCH[-1](7) 0 <> | 3: EXACT <.>(5) failed... failed... 2 | 1:IFMATCH[-1](7) 1 | 3: EXACT <.>(5) failed... failed... 3 <.foo> | 1:IFMATCH[-1](7) 2 | 3: EXACT <.>(5) failed... failed... 4 | 1:IFMATCH[-1](7) 3 <.foo> | 3: EXACT <.>(5) 4 | 5: SUCCEED(0) subpattern success... 4 | 7:STAR(19) ANYOF[\0-\-/-\377{unicode_all}] can match 3 times out of 2147483647... 7 <> | 19: EOL(20) 7 <> | 20: END(0) Match successful! #### Compiling REx "\.\K[^.]*$" Final program: 1: EXACT <.> (3) 3: KEEPS (4) 4: STAR (16) 5: ANYOF[\0-\-/-\377{unicode_all}] (0) 16: EOL (17) 17: END (0) anchored "." at 0 floating ""$ at 1..2147483647 (checking anchored) minlen 1 Guessing start of match in sv for REx "\.\K[^.]*$" against "xyz.foo" Found anchored substr "." at offset 3... Found floating substr ""$ at offset 7... Starting position does not contradict /^/m... Guessed: match at offset 3 Matching REx "\.\K[^.]*$" against ".foo" 3 <.foo> | 1:EXACT <.>(3) 4 | 3:KEEPS(4) 4 | 4: STAR(16) ANYOF[\0-\-/-\377{unicode_all}] can match 3 times out of 2147483647... 7 <> | 16: EOL(17) 7 <> | 17: END(0) Match successful!