.replace(/([^s]?s)$/, '')
I thought [^abc]
meant "not any of these characters" but in the code above, it's replacing the s at the end of the word only if there's an s before it. How would I make this regex into: replace the s at the end of the word, only if there's no s before it?
No comments:
Post a Comment