Fix deprecation warnings on libregex tests

Fixes #20280