-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
A 4th parameter as callback to process non-match items would be useful.
For instance, in ReactNative, plain text cannot be outside of <Text>
components. The non matches need to be wrapped in a component as well. A callback for these would come quite handy.
Example:
const matchCallback = (match, i) => (<Text key={i} style={styles.highlight}>{match}</Text>);
const nonMatchCallback = (nonmatch, i) => (<Text key={i}>{nonmatch}</Text>);
const components = reactStringReplace(input, regex, matchCallback, nonMatchCallback);
masoudgs