Skip to content

Commit

Permalink
v2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kaboc committed Dec 3, 2023
1 parent 1b1efa7 commit f982753
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Dart CI

on:
# push:
push:
# branches: [main]
tags:
- '*'
pull_request:
branches: [main]
workflow_dispatch:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.1.1

- Fix `UrlMatcher` and `UrlLikeMatcher` to allow a character from a very limited
set of types at the end of a URL.

## 2.1.0

- Add `matcherIndex` to `TextElement`. ([#14])
Expand Down Expand Up @@ -134,3 +139,4 @@
[#10]: https://github.com/kaboc/dart_text_parser/pull/10
[#12]: https://github.com/kaboc/dart_text_parser/pull/12
[#14]: https://github.com/kaboc/dart_text_parser/pull/14
[fb56445]: https://github.com/kaboc/dart_text_parser/commit/fb5644553f7e271e2f7fa73747d9451a86419373
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,18 @@ Output:
### Groups

Each [TextElement][TextElement] in a parse result has the property of
[groups][TextElement_groups]. It is an array of strings that have matched the smaller pattern
[groups][TextElement_groups]. It is a list of strings that have matched the smaller pattern
inside every set of parentheses `( )`.

To give the above code as an example, there are two sets of parentheses; `(.+?)` in `\[(.+?)\]`
and `\((.+?)\)`. They match "foo" and "bar" respectively, so they are added to the array in
that order.
Below is an example of a pattern that matches a Markdown style link.

```dart
r'\[(.+?)\]\((.*?)\)'
```

This pattern has two sets of parentheses; `(.+?)` in `\[(.+?)\]` and `(/*?)` in `\((.*?)\)`.
When this matches `[foo](bar)`, the first set of parentheses captures "foo" and the second
set captures "bar", so `groups` results in `['foo', 'bar']`.

Tip:

Expand All @@ -191,8 +197,6 @@ parenthesis, like `(?:pattern)` instead of `(pattern)`.
#### Named groups

Named groups are captured too, but their names are lost in the resulting `groups` list.
Therefore, it does not affect the result which of unnamed or named groups are used.

Below is an example where a single match pattern contains capturing of both unnamed and
named groups.

Expand Down
6 changes: 5 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: text_parser
description: A Dart package for flexibly parsing text into easy-to-handle format according to multiple regular expression patterns.
version: 2.1.0
version: 2.1.1
repository: https://github.com/kaboc/dart_text_parser

topics:
- text
- parser

environment:
sdk: '>=2.18.0 <4.0.0'

Expand Down

0 comments on commit f982753

Please sign in to comment.