In a follow-up to this question, I need to compare two strings in a case-insensitive manner, ignoring any non-alphanumeric characters except the comma and the semicolon, in JavaScript. So
Times New Roman, Times, Sans-Serif
matches
Times New Roman,Times,SansSerif
Can somebody get me started with the right function/approach? Is there something ready-made to do this in JS, or do I have to cut all clutter from both strings and compare them then?
Normalize both strings and compare them:
Here the strings are converted to lowercase and then all characters except alphanumeric characters, the comma and semicolon are removed before comparison.