detectable_text_field
detectable_text_field copied to clipboard
Add the ability to reduce the RegExp matching
Currently, when a RegExp is passed into the detectable text field, it is used to discover all matches within the text.
final tags = detectionRegExp.allMatches(copiedText).toList();
detector.dart
However, I want to only match the first regexp within the text to highlight only the first mention of a @username
. Is it possible to add a boolean to the detector to conditionally match the first or all matches to the RegExp.
final bool matchFirst;
...
final tags = matchFirst ? [detectionRegExp.firstMatch(copiedText)]
: detectionRegExp.allMatches(copiedText).toList();
I proposed a change for this in #30.