lodash icon indicating copy to clipboard operation
lodash copied to clipboard

Split Based on Multiple Words

Open MohitVachhani opened this issue 4 months ago • 0 comments

For example:

const input = "apple-orange banana_grape";
const result = _.split(input, ['orange', 'banana']); 
// Expected result: ['apple-', ' grape']

However, this approach doesn’t seem to work. Is there currently any functionality in Lodash that allows splitting a string by multiple words?

Use Case: This feature would be valuable when parsing text or documents where specific words serve as delimiters, especially in data extraction and text processing scenarios.

MohitVachhani avatar Oct 16 '24 18:10 MohitVachhani