Download the PHP package ahorkh/reverse-regex without Composer
On this page you can find all versions of the php package ahorkh/reverse-regex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package reverse-regex
ReverseRegex
Use Regular Expressions to generate strings.
- Installation
- Usage
- About
- Requirements
- Support
- Contributing
- License
Installation
This library is installed via Composer. To install, use composer require pointybeard/reverse-regex
in your application.
Usage
See https://github.com/pointybeard-forks/ReverseRegex/tree/master/examples for more examples.
Notes When Writing Regular Expressions
- Escape all meta-characters i.e. if you need to escape the character in a regex you will need to escape here.
- Not all meta-characters are suppported see list below.
- Use
\X{####}
to specify unicode value use[\X{####}-\X{####}]
to specify range. - Unicdoe
\p
not supported, I could not find a port of UCD to php, maybe in the future support be added. - Quantifiers are applied to left most group, literal or character class.
- Beware of the
+
and*
quantifers they apply a possible maxium number of occurances up toPHP_INT_MAX
.
Supported Syntax
Example | Description | Resulting String |
---|---|---|
(abcf) |
Support literals this would generate string | 'abcf' |
\((abcf)\) |
Escape meta characters as you normally would in a regex | '(abcf)' |
[a-z] |
Character Classes are supported | 'a' |
a{5} |
Quantifiers supported always last group or literal or character class | 'aaaaa' |
a{1,5} |
Range Quantifiers supported | 'aa' |
a\|b\|c |
Alternation supported pick one of three at random | 'b' |
a\|(y\|d){5} |
Groups supported with alternation and quantifiers | 'ddddd', 'a', or 'yyyyy' |
\d |
Digit shorthand equ [0-9] | '1' |
\w |
word character shorthand equ [a-zA-Z0-9_] | 'j' |
\W |
Non word character shorthand equ [^a-zA-Z0-9_] | 'j' |
\s |
White space shorthand ASCII only | ' ' |
\S |
Non White space shorthand ASCII only | 'i' |
. |
Dot all ASCII characters | '\$' |
* + ? |
Short hand quantifiers, recommend not use them | |
\X{00FF}[\X{00FF}-\X{00FF}] |
Unicode ranges | |
\xFF[\xFF-\xFF] |
Hex ranges |
About
Requirements
- This library works with PHP 7.2 or above.
Support
If you believe you have found a bug, please report it using the GitHub issue tracker.
Author
- Lewis Dyer (http://www.icomefromthenet.com, https://github.com/icomefromthenet/ReverseRegex) - Original author
- Alannah Kearney (https://github.com/pointybeard) - Fixed a few things after library was abandoned
- See also the list of contributors who participated in this project
License
"ReverseRegex" is released under the MIT License. See LICENCE for details.
All versions of reverse-regex with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.2
doctrine/lexer Version ^1.2
doctrine/collections Version ^1.6
symfony/polyfill-mbstring Version ^1.23
doctrine/lexer Version ^1.2
doctrine/collections Version ^1.6
symfony/polyfill-mbstring Version ^1.23
The package ahorkh/reverse-regex contains the following files
Loading the files please wait ....