Open ibrahimEltayfe opened 1 month ago
Hi, I'm encountering an issue when using multiple annotations when specifying multiLine or unicode or any other properties in the RegExp . I'm using the following regex patterns to detect hashtags and mentions in text:
final RegExp hashtagTextRegex = RegExp( r'#([\p{L}\p{N}_]+)', multiLine: true, unicode: true ); final RegExp mentionTextRegex = RegExp( r'@([\p{L}\p{N}_]+)', multiLine: true, unicode: true );
the problem is when using these two annotations, multiLine and unicode is not applying, maybe the problem is in this method _mergeRegexPatterns
RegExp? _mergeRegexPatterns(List<Annotation>? annotations) { if (annotations == null || annotations.isEmpty) { return null; } else if (annotations.length == 1) { return annotations[0].regExp; } // replacing groups '(' => to non capturing groups '(?:' return RegExp( annotations .map( (a) => '(${a.regExp.pattern.replaceAll(_nonCapturingGroupPattern, '(?:')})', ) .join('|'), ); }
when merging annotations, it does not apply the other properties of the regex.
Hi, I'm encountering an issue when using multiple annotations when specifying multiLine or unicode or any other properties in the RegExp . I'm using the following regex patterns to detect hashtags and mentions in text:
the problem is when using these two annotations, multiLine and unicode is not applying, maybe the problem is in this method _mergeRegexPatterns
when merging annotations, it does not apply the other properties of the regex.