flutter_parsed_text
flutter_parsed_text copied to clipboard
Nested or Overlapped MatchText
As it is now, it seems I'm unable to nest multiple matchtext without specifically writing a regex pattern to match for the amalgamation of the two. Let's say I have italics and I check for it with "(i) Test (i)" (test), and bold with "(b) Test (b)" (test) . A combination of the two simply seems to match the outer set and ignore anything within. A bold and italicized text writted as "(b) (i) Test (i) (b) " simply parses as "(i) Test (i)" in bold.
That's straightforward nesting, disregarding partial overlapping such as "(i) This is (b) a test (i) to check (b)" But this is likely far more complicated to do.
I understand allowing for applying multiple text matching to a single portion of text might conflict with multiple text styles, but why not have a list of parsed with the order of parsing, overwriting the previous one matched, in case of any conflicting parameters, the same for the onTap() function. Is this a feasible request? Thanks!
The behavior you are observing is intentional, Initial this package used to override the previously parsed text, lets say you have this https://apps.apple.com/id/app/facebook/id284882215
If you passed Email
& Phone
as MatchText
this would get parsed as https://apps.apple.com/id/app/facebook/id
and this end part 284882215
would be parsed as Phone so I changed how the package works.
So now whenever a match is found it is padded with %%%%
so in your case (b) (i) Test (i) (b)
this would become %%%%(b) (i) Test (i) (b)%%%%
so next time when its run through next MatchText
it won't be matched with the regex pattern.
Hope this helps.
Hi, is this in commit 0fad3e7
(v.1.1.2 -> v1.2.0)? Thinking of forking, adding Boolean and sending a merge request. By the way, this package has been really useful in multiple ways, I like how customizable it is. Thanks :)
Yes, that's the commit. Feel free to make a PR too.
Is there any update on this? I love how easy this package is to use, but I'm trying to parse a custom markdown language and not having nested matching makes things ... hard.
I was thinking maybe we could add a boolean to MatchText that indicates wether or not to match the text multiple times.
is it possible to support nested matching?