T-Regx recommended way of installation is using Composer.
The installation of T-Regx is really simple - just add a composer dependency:
T-Regx supports PHP versions:
Before you install, you can try T-Regx online, right in your browser.
Just visit T-Regx on repl.it, and when it boots up (after about 4 seconds), just click "Run" at the top.
You can log in to repl.it with GitHub account, Google account, Facebook account or regular credentials.
There are two files in the fiddle: You can edit
EDIT_HERE.php as you please;
EXAMPLES.php contains many basic and complicated examples of T-Regx.
Go to repl.it and run the
EXAMPLES.php or your file in
You can either download an executable setup from https://getcomposer.org/download/, or use a script to download it, right from your terminal (Windows and Unix).
Once downloaded, install T-Regx.
/n modifier added in PHP 8.2#
While that is true that in vanilla regular expressions in PHP (e.g.
/n is only available in PHP 8.2, in T-Regx regular expressions modifier
/n is available in
Pattern in every supported PHP version.
It's not just an interface trick, the group really isn't being captured.
In the example above,
$pattern will throw
MalformedPatternException, since it tries to
perform matching using group reference
\1, but the group doesn't exist. Modifier
can be used with
Pattern in any supported PHP version as if it was implemented natively. Replacing
withReferences() also works as expected, so that used references (e.g.
$1) are not
being resolved, unless the group was explicitly named.