lodash
lodash copied to clipboard
Split Based on Multiple Words
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.