From 112f62ae55d459684126ee13421ff8a630ee7d4a Mon Sep 17 00:00:00 2001 From: Kabo <20254485+kaboc@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:13:01 +0900 Subject: [PATCH] 2.3.0 --- CHANGELOG.md | 5 +++++ README.md | 16 ++++++++++++++++ pubspec.yaml | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f24e9..4cb11c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.3.0 + +- Change `matchers` of TextParser from `List` to `Iterable`. +- Add `ExactMatcher`. + ## 2.2.0 - Improve `parse()` to skip parsing if text is empty. diff --git a/README.md b/README.md index 14b5b1a..b51c90c 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,21 @@ Output: [https://example.com/, Content inside tags] ``` +### ExactMatcher + +`ExactMatcher` escapes reserved characters of RegExp so that those are used +as ordinary characters. The parser extracts the substrings that exactly match +any of the strings in the passed list. + +```dart +TextParser( + matchers: [ + // 'e.g.' matches only 'e.g.', not 'edge' nor 'eggs'. + ExactMatcher(['e.g.', 'i.e.']), + ], +) +``` + ### Groups Each [TextElement][TextElement] in a parse result has the property of @@ -241,6 +256,7 @@ These options are passed to [RegExp][RegExp] internally, so refer to its [UrlLikeMatcher]: https://pub.dev/documentation/text_parser/latest/text_parser/UrlLikeMatcher-class.html [EmailMatcher]: https://pub.dev/documentation/text_parser/latest/text_parser/EmailMatcher-class.html [TelMatcher]: https://pub.dev/documentation/text_parser/latest/text_parser/TelMatcher-class.html +[ExactMatcher]: https://pub.dev/documentation/text_parser/latest/text_parser/ExactMatcher-class.html [PatternMatcher]: https://pub.dev/documentation/text_parser/latest/text_parser/PatternMatcher-class.html [parse]: https://pub.dev/documentation/text_parser/latest/text_parser/TextParser/parse.html [TextElement]: https://pub.dev/documentation/text_parser/latest/text_parser/TextElement-class.html diff --git a/pubspec.yaml b/pubspec.yaml index f9bac3c..42b4b06 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: text_parser description: A Dart package for flexibly parsing text into easy-to-handle format according to multiple regular expression patterns. -version: 2.2.0 +version: 2.3.0 repository: https://github.com/kaboc/dart_text_parser topics: