I’m aware of how to replace string; e.g., replace hyphen with underscore in a file.
However, I wish to replace all hyphens with underscore for all text that falls within angle brackets in a given file.
For example, the below file:
<charset-params> <input-charset> <resource-path>/*</resource-path> <java-charset-name>UTF-8</java-charset-name> </input-charset> </charset-params>
should change to:
<charset_params> <input_charset> <resource_path>/*</resource_path> <java_charset_name>UTF-8</java_charset_name> </input_charset> </charset_params>
Note that UTF-8
is unchanged because it is not within angle brackets. How can I do this?