in reply to Re: Match full utf-8 characters
in thread Match full utf-8 characters

This works if $str is implicitly provided in the script, but not when it is read from stdin.