T-Regx
T-Regx copied to clipboard
Simple library for regular expressions in PHP.
We're trying to make T-Regx reliable on PHP 8.2, probably it currently runs fine on PHP8.2, but we're not sure of that yet. For example, certain error messages from PCRE...
That way, we could build regular expressions with in-pattern flags. ```php Pattern::template("return @();")->pattern('strlen', 'i'); ``` That would match ``` return strlen(); return strLen(); return STRLEN(); ``` but not ``` RETURN...
Currently, users of PHP regexp have only two choices: - `preg_match_all()`, which performs all available matches right away - `preg_match()`, which performs only a single match The problem with `preg_match_all()`,...
To do: - [ ] Change namespace `TRegx\CleanRegex\` to `TRegx\Pattern\` - [x] Change namespace `TRegx\SafeRegex\` to `TRegx\Preg\` - [ ] Design `ReadMe.md` for both projects
Its possible to protect against CatastrophicBacktrackingException when we're going `replace()->only(int)->callback()`, if `Detail` isn't used with `group()`, `all()` or `usingDuplicateName()`.
Currently, documentation states that "you only need to replace `preg_` with `preg::`", but that's not true, since you also need to add the namespace. We should remove the namesapce so...
- [ ] Include a detailed documentation of every public method - [ ] Include only `@param`, `@returns` and `@throws` tags. - [ ] Include `@psalm` and `@phpstan` annotations -...
I think it's more readable.
Add: - refactorings - inspections - quick fixes Example actions and inspections could include: - change `$pattern->match($s)->test()` to `$pattern->test($s)` - change `$pattern->match($s)->first()->text()` to `$pattern->search($s)->first()` - change `Pattern::inject('@', [$value]);` to `Pattern::literal($value)`