preg_replace and comment_form_defaults

You can use regex anywhere you have a string to manipulate. That is basic PHP. There is nothing special about WordPress that changes that.

But why use regex when there are other options? As much fun as it is, regex is tricky and easy to get wrong, and there is significant overhead to using it.

What you are doing generates an “array to string conversion” Notice, by the way. preg_replace will accept an array of strings as the third parameter but $defaults['fields'] is an array so you get an Notice so it wouldn’t work as expected if you tried to alter that field.