I need help writing a regex function that converts HTML string to a valid XML tag name. Ex: It takes a string and does the following:
- If an alphabet or underscore occurs in the string, it keeps it
- If any other character occurs, it's removed from the output string.
- If any other character occurs between words or letters, it's replaced with an Underscore.
Ex: Input: Date Created Ouput: Date_Created Input: Date<br/>Created Output: Date_Created Input: Date\nCreated Output: Date_Created Input: Date 1 2 3 Created Output: Date_Created
Basically the regex function should convert the HTML string to a valid XML tag.