Skip to content
Advertisement

how could set multi separator of “_.truncate” of Lodash?

how can I separate by “,” or “-” or ” ” ?

JavaScript

if setting "/,- +/" is not working, what should I do?

Advertisement

Answer

Your regular expression is basically saying, “match ,- followed by at least one space”.

Check it on Regex101

This would match ",- ", for example.

What you want is a character group of ,, - and space (note that you need to escape - there):

JavaScript

Check it on Regex101

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement