in reply to Complex Regex

s/\b\w{3}\b/hi/g would perform the substitution in a document where there could be multiple potential groups per string. If you just want to limit the match to strings that are exactly three characters long, it becomes simpler. s/\A\w{3}\z/hi/

Try it out: The first version. Notice how the "List Context Return Values" captured by the example pattern exclude any substring that is more than three characters long.

And the second version, where there can be only one case per string.

perlrequick and perlretut would be helpful for you.


Dave