perl -Dr -e ' @l = ("A".."Z","a".."z",qw(< / >),0..9); $_ = join( "", map { $l[ rand @l ] } 1 .. 100_000 ) . ""; s|()$|zzz$1| ' Compiling REx "()$" rarest char < at 0 Final program: 1: OPEN1 (3) 3: EXACT <> (8) 8: CLOSE1 (10) 10: EOL (11) 11: END (0) anchored ""$ at 0 (checking anchored) minlen 14 Omitting $` $& $' support. EXECUTING... Guessing start of match in sv for REx "()$" against "Fw3EK>>Y6xx4s7sACk6xtpG9etod1O4uibfbVBwJNJLRurKYn>SdVRt2o"... Found anchored substr ""$ at offset 100000... Starting position does not contradict /^/m... Guessed: match at offset 100000 Matching REx "()$" against "" 100000 < | 1:OPEN1(3) 100000 < | 3:EXACT <>(8) 100014 > <> | 8:CLOSE1(10) 100014 > <> | 10:EOL(11) 100014 > <> | 11:END(0) Match successful! Freeing REx: "()$"