javascript - How to remove symbols from beginning and end of a string, except certain symbols? -
i using regex:
/^[^a-z\d]*|[^a-z\d]*$/gi
this checks symbol in beginning , end of string.
however, want exclude these 4 symbols being removed:
( ) [ ]
how can modify regex doesn't remove symbols?
then can add them excludes list:
/^[^\(\[\)\]a-z\d]*|[^\(\[\)\]a-z\d]*$/gi
(if understand correctly , want remove symbols first occurence of 1 of these symbols - if not, not single regex, think)
Comments
Post a Comment