Skip to content

Commit

Permalink
[i] update pod + CHANGES
Browse files Browse the repository at this point in the history
Took 21 minutes
  • Loading branch information
AlexP007 committed Mar 18, 2022
1 parent af75dbf commit 7c1fd5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.25 2022-03-18 17:09:54 Europe/Moscow
- Fixed bug with built-in $MATCH

1.24 2022-01-16 10:59:29 Europe/Moscow
- Minor inner refactoring

Expand Down
13 changes: 8 additions & 5 deletions lib/Regex/Object.pm
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ version 1.24
# Works with match regex
my $re = Regex::Object->new;
my $success;
my @matches;
while ('John Doe Eric Lide Hans Zimmermann' =~ /(?<name>\w+?) (?<surname>\w+)/g) {
my $match = $re->collect;
while ($success = John Doe Eric Lide Hans Zimmermann' =~ /(?<name>\w+?) (?<surname>\w+)/g) {
my $match = $re->collect($success);
push @matches, $match;
}
Expand Down Expand Up @@ -198,12 +199,14 @@ Execute while loop on regex with g modifier and returns Regex::Object::Matches c
my $matches = $re->match_all('John Doe Eric Lide');
=head3 collect()
=head3 collect($success = undef)
Returns Regex::Object::Match result DTO filled with values from the nearest global match expression.
$string =~ /(\w*)/
my $result = $re->collect;
my $success = $string =~ /(\w*)/
my $result = $re->collect($success);
ATTENTION!! Always pass $success, otherwise strange behavior is possible, because of built-in $MATCH saving last success.
=head2 Regex::Object::Match METHODS
Expand Down

0 comments on commit 7c1fd5b

Please sign in to comment.