Repository navigation
Releases: t-regx/T-Regx
Release list
0.19.0 - Adding Structure as counting() argument
😎 T-Regx The Dinosaur is really proud to announce its release 0.19.0! It's a really small release, with the addition of a new argument for replace()->counting().
The detailed list of changes is in ChangeLog.md.
- Breaking changes
- Rename
BaseDetailtoStructure
- Rename
- Features
- Add second argument
Structureas second parameter toreplace()->counting()
- Add second argument
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!
0.18.0 - Preparation for the replace update
😎 T-Regx The Dinosaur is really proud to announce its release 0.18.0! That's just an intermediate version, that will allow you to upgrade more seamlessly.
We're in the middle of a general rewrite of the Replace Module (the pattern()->replace() part), and in the meantime, we have to rethink certain ideas. The sad part is, we must let certain methods go, like otherwise() - leaving room for more exciting new methods. So, for now, let's keep an open mind, to be ready for the next realease refreshed Replace Module. It won't change much, we promise! :)
The detailed list of changes is in ChangeLog.md.
- Breaking changes
- Removed
replace()->otherwise(). Usecounting()instead. - Removed
replace()->otherwiseReturning(). Usecounting()instead. - Removed
replace()->otherwiseThrowing(). Usecounting()oratLeast()instead.
- Removed
- Other
- T-Regx follows Semantic Versioning 2
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!
v0.17.0 - We're ripping Java off
😎 T-Regx The Dinosaur is really proud to announce its release 0.17.0! We're coming to giga-big-release of 1.0.0 with big steps!
We noticed that interface of FluentMatchPattern (result of pattern()->match()->fluent()) and its idea, conceptually, is similar to Java8 streams. Semi-functional programming approach, with terminal statements. We decided it was a good idea to make the name more descriptive, so that, if a dinosaur lover knows Java by some accident, he could find similarities here.
So we just renamed FluentMatchPattern to Stream. And also fluent() method to stream().
The detailed list of changes is in ChangeLog.md.
- Bug fixes
- Fixed a bug when returning non-string value from
orElseCalling()didn't throwInvalidReturnValueException
- Fixed a bug when returning non-string value from
- Breaking changes
- Renamed
FluentMatchPatterntoStream, similar to Java 8 streams - Renamed
fluent()tostream(), similar to Java 8 streams - Renamed
NoSuchElementFluentExceptiontoNoSuchStreamElementException
- Renamed
- Features
- Added
IntStream.stream()
- Added
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!
v0.16.0 - Refactor of asInt() and offsets()
😎 T-Regx The Dinosaur is really proud to announce its release 0.16.0! This time, we found out that by simplifying T-Regx internal implementation, we can actually simplify the public interface of the library as well! Cool, isn't it? :D
Currently, when you call pattern()->match()->fluent(), you receive FluentMatchPattern (something like Stream from Java8). However, when you call pattern()->match()->asInt() and pattern()->match()->offsets() you also receive FluentMatchPattern, which behaves slightly in a different way (for example throws different exceptions).
We stoped for a minute a thought - waidaminute, something's wrong, I can feel it. So we decided that what must be done is fluent() must be separated from asInt() and offsets(). That's how IntStream was born.
The detailed list of changes is in ChangeLog.md.
- Breaking changes
-
Methods
asInt()andoffsets()returnIntStreaminstead ofFluentMatchPattern. -
Removed
FluentMatchPatternException. In case ofasInt(),InvalidIntegerTypeExceptionis thrown instead. -
Updated the rules when exceptions are thrown from
asInt(),offsets()andfluent():- Exceptions thrown from
IntStream:pattern()->match()->asInt()throwsSubjectNotMatchedExceptionpattern()->match()->offsets()throwsSubjectNotMatchedExceptionpattern()->match()->group()->asInt()throwsSubjectNotMatchedExceptionorGroupNotMatchedExceptionpattern()->match()->group()->offsets()throwsSubjectNotMatchedExceptionorGroupNotMatchedException
- Exception thrown from
FluentMatchPattern:pattern()->match()->fluent()throwsNoSuchElementFluentExceptionpattern()->match()->asInt()->fluent()throwsNoSuchElementFluentExceptionpattern()->match()->offsets()->fluent()throwsNoSuchElementFluentException
Basically,
MatchPatternandIntStreamthrow match-related exceptions (SubjectNotMatchedException
orGroupNotMatchedException), whereasFluentMatchPatternthrows fluent-related
exception:NoSuchElementFluentException. - Exceptions thrown from
-
Updated exception messages from
asInt(),offsets()andfluent(). -
MatchPatternInterfaceis no longer part of T-Regx public API.
-
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!
0.15.0 - Templates and builders update!
😎 T-Regx The Dinosaur is really proud to announce its release 0.15.0! We're coming to giga-big-release of 1.0.0 with really big steps!
This time, we look around our dinosaur friendly projects, and we noticed that most users use Pattern::template() with just one call, and need to call build() at the end. That's not very elegant, T-Regx the dinousaur said, and we agree! That's why we refactored. The API a little bit.
The detailed list of changes is also in ChangeLog.md.
Previously, to create a template, you needed to call Pattern::template()->something()->build(). This is looong and inconvenient. Here's what we did.
- Breaking changes
- Renamed
Pattern::template()toPattern::builder(). So if you need to build many elements, you can goPattern::builder($yourTemplateHere) ->literal($value) ->mask($mask, $keys) ->build();
- Renamed
- Features
- Added
Pattern::template(), which works similarly toPattern::builder()but allows only one chain:$pattern = Pattern::template('^@$')->literal('Hi!'); // that's it
- Added
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!
0.14.0 - Quicky Pattern::compose() update
😎 T-Regx The Dinosaur is proud to announce its release 0.14.0! That's a quick release with the update of a few names regarding Pattern::compose(). allMatch() wasn't a really good name, was it?
The detailed list of changes is also in ChangeLog.md.
-
Breaking changes
- Name
Pattern::compose()->allMatch()was horrible, we renamed it totestAll() - Name
Pattern::compose()->anyMatches()wasn't good either, we renamed it totestAny()
So, if you want to test a composite pattern, you just type
Pattern::compose()->testand chooseAny()orAll():)- Renamed
Pattern::compose()->chainedRemove()toprune(), because "chained remove" was basically prune, just with a more scary name 😨
- Name
-
Features
- Added
Pattern::compose()->failAny(), returningtrueif any of the patterns didn't match the subject - Added
Pattern::compose()->failAll(), returningtrueif all the patterns didn't match the subject
Same as before, if you'd like to check if your composite pattern fails a subject, just type
Pattern::compose()->failand chooseAny()orAll():) - Added
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!
0.13.8 - Fixed PHP reporting valid patterns as invalid
😎 T-Regx The Dinosaur is really proud to announce its release 0.13.8! We're coming to giga-big-release of 1.0.0 with big steps!
In this release, we took a look at how PHP parses the patterns, before passing them to PCRE, and it shocked us! that it does so negligent. Perfectly valid patterns are reported as invalid by PHP, because of improper parsing.
Example:
- Pattern
/\c\/is marked as invalid in PHP. So is/\Q\/and other valid patterns (like comment groups and comments in exnteded mode)
In this release we handled this bug, so that pattern(), Pattern::of(), Pattern::mask() and Pattern::template() correctly understand these patterns. We parse the whole pattern, and we guess if it would be reported by PHP, and we fill it with padding, to make it digest by PHP, while keeping the meritoric value. For example, T-Regx changes \c\ to \c\{1} which is the same thing in regular expression, but PHP reports the first as invalid.
You, as a user of T-Regx don't have to worry about it at all. Simply use you regular expression, and let T-Regx handle it for you.
The detailed list of changes is in ChangeLog.md.
- Bug fixes
- Fixed a bug, where using
Pattern::inject('()(?)')failed parsing - Fixed a bug, where using unicode in groups failed parsing
- Fixed a bug, where using pattern in unclosed comment group failed parsing
- Added workaround for PHP inconsistencies ragarding backslash in patterns:
- PHP reports
\c\as invalid entity, all T-Regx entry points correctly recognize it as valid - PHP reports
\Q\as invalid entity, all T-Regx entry points correctly recognize it as valid - PHP reports
(?#\as invalid entity, all T-Regx entry points correctly recognize it as valid - PHP reports
#\as invalid entity inXtended mode, all T-Regx entry points correctly recognize it as valid
- PHP reports
- Fixed a bug, where using
- Features
- Added
Optional.map(), which resembles Java 8 optionals. pattern()->match()->asInt()->findFirst()->orElse()receiveNotMatchedargumentpattern()->match()->asInt()->findNth()->orElse()receiveNotMatchedargumentpattern()->match()->offsets()->findFirst()->orElse()receiveNotMatchedargumentpattern()->match()->offsets()->findNth()->orElse()receiveNotMatchedargument
- Added
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!
0.13.5 - Refactor of pcre() API
😎 T-Regx The Dinosaur is really proud to announce its release 0.13.5! We're coming to giga-big-release of 1.0.0 with big steps!
The detailed list of changes is in ChangeLog.md.
- Breaking changes
- We refactored
Pattern::pcre(), so it's more concise, and doesn't usebuilder()method.
- We refactored
- Features
- Added
Pattern::alteration()which allows buildingPatternwith just an alteration group.- For example
Pattern::alteration(['foo', 'bar'])is/(?:foo|bar)/
- For example
- Added
Pattern::template()->alteration()
- Added
- Bug fixes
- Fixed a bug, where passing
falseas an alteration value didn't throw\InvalidArgumentException.
- Fixed a bug, where passing
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!
0.13.4 - Integer bases
😎 T-Regx The Dinosaur is really proud to announce its release 0.13.4! We're coming to giga-big-release of 1.0.0 with big steps! From the last 0.12.0 release, we put more effort on rewriting the integer parsing, group building and more through exceptions in T-Regx.
Here's a summary of changes from 0.13.0, 0.13.1, 0.13.2, 0.13.3 and in 0.13.4.
The detailed list of changes is in ChangeLog.md.
- Features:
- Previously,
toInt()/asInt()/isInt()assumed the numerical string was always in base 10, before mapping toint. Now, the base is passed in as an optional arugment (e.g.asInt(2)), and the default value of the argument is10. Allowed base are2-36, and allowed digits are/[0-9a-z]/i(depending on the base). toInt()/asInt()now throw eitherNumberFormatException(as before), orNumberOverflowException, if number is well formatted, but exeeds integer size on a given architecture.
- Previously,
- Breaking chages:
- We removed
match()->asArray(), becauseDetail.group()andDetail.namedGroup()are better suited for this job. pattern()->forArray()is now strict by default.- Removed
pattern()->remove()->all()/remove()->first(), because removing single occurrance felt weird. Now usepattern()->prune(). - Previously
filter()andremaining()would leave keys in the resulting array unchagnes (as if they treatedarrayas dictionary/map). Now the keys are now re-indexed (as if they treatarrayas list). To make use of keys, useflatMap()/flatMapAssoc()orgroupBy()/groupByCallback().
- We removed
- Bug fixes
- We fixed a bug with
fluent()->first(), where sometimes a silence false-negative with group being missing slipped by us. ExceptionGroupNotMatchedwas thrown, where in reallityNonexistentGroupshould have been thorwn. - Fixed w bug where using Detail.usingDuplicateName() didn't throw NonexistentG
- We fixed a bug with
match()->asInt()->keys()->first()malformed integers didn't throwNumberFormatException
- We fixed a bug with
- We now created docker images to run our Github Actions against, in order to run tests on 32-bit architecture, as well as 64-bit (which was the only option). We did this, in order to make sure that integer parsing works well for both types of integer.
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!
0.12.0 - More careful placeholders in prepared patterns
😎 T-Regx The Dinosaur is really proud to announce its twelfthversion! We found loose approach to @ placeholders in prepared patterns, so we had to create a dedicated regular patterns parses that works with PCRE7, PCRE8, PCRE9 and PCRE10 instroduced in PHP8 and late PHP 7.4. Using the pattern, we can distinguish @ as literal (where it can be injected with values), or in character class, quotes or comments ([@], \Q@\E and #@\n, etc.) We also found that bind() method failed to fulfill its intented purpose, so it was removed from the library, however template() and inject() remain in the library. Also, also we also strictened the rules of pattern()->forArray().
The detailed list of changes is in ChangeLog.md.
- Features
- We added internal regular expression parser, that's used when creating Prepared patterns. Now in-pattern
structures can be properly recognized, eliminating cases of misuse. Most notablly[@],\Q@\E,\@,\c@and
others, like comment groups and comments in extended mode.
- We added internal regular expression parser, that's used when creating Prepared patterns. Now in-pattern
- Breaking changes
- Prepared patterns now use internal regular expression parser, to determine what is a placeholder and what isn't:
- Previously,
[@]would be injected. Now it's treated as"@"character-class. - Previously,
\Q@\Ewould be injected. Now it's treated as@literal. - Previously,
\c@would be injected. Now it's\c@control character. - Previously,
#@\nwould be injected. Now, ifxflag is used (globally, or as a subpattern), then it's
treated as@comment. - Previously,
(?#@)would be injected. Now it's treated as@comment. - Previously,
\@would be treated as@literal. This remains unchanged.
- Previously,
- Mask placeholders are no longer represented as
&in templates, use@. - Refactored
Pattern::template()->builder(). UsePattern::template()now. - Removed
Pattern::bind(). UsePattern::inject()orPattern::template()->literal(). - Removed
Pattern::prepare(). UsePattern::inject(). - Removed
Pattern::pcre()->bind(). - Removed
Pattern::pcre()->prepare(). - Removed
Pattern::template()->bind().
- Prepared patterns now use internal regular expression parser, to determine what is a placeholder and what isn't:
- Bug fixes
- Correct type-error in
ValidPattern.isValid()on PHP 8.1.
- Correct type-error in
The detailed list of changes is also in ChangeLog.md.
Rawrrrr!