I need to take a string and allow only the first occurrence of an
apostrophe for the validation of a city name...
Example: D'Iberville, MS
Say someone enters D'I'berville, MS by mistake..
I'm able to retain all the apostrophes with the following:
city.replace(/[^a-zA-Z0-9\'\$\,\.\#\s]/g,"");
I want to retain the first apostrophe only. I've tried adding {2,} in
with the apostrophe, but no luck.
An example of the proper way to do this would be greatly appreciated.
Thanks.