javascript - How to remove text between a delimiter and whitespace or punctuation? -
i have javascript array of strings synonyms indicated caret. examples follows:
i'm baffled^bemused decision."why mean^nasty?" wailed^moaned.
i want return:
i'm baffled decision."why mean?" wailed.
this /\^([^^]*)\./ works single punctuation marks, haven't been able function [.,:;?"' ]. i'm grateful on this.
you want search , replace empty string using regex:
\^([^^]*?)(?=[.,:;?"' ]) you can see portions replacing, detailed visual of what's going on regex, on www.debuggex.com.
Comments
Post a Comment