in reply to Re^3: regex to rename last _ with ,
in thread regex to rename last _ with ,

First, I can never remember the exact syntax of the look-around assertions

They're fairly mnemonic, actually:

Personally I might've chosen (?>=PATTERN) and (?>!PATTERN) for lookahead assertions to make the syntax of these symmetric in direction as well (though that would've clashed with non-backtracking patterns), but even this way I still think these are fairly easy to remember.

Replies are listed 'Best First'.
Re^5: regex to rename last _ with ,
by Grimy (Pilgrim) on Sep 15, 2014 at 09:36 UTC

    Look-ahead is used much more frequently than lookbehind, hence the shorter syntax. Perl is quite heavily Huffman coded.

    Look-behind is actually almost useless, since variable-length look-behind isn’t supported. It can be approximated using \K