Download the PHP package codekandis/regular-expressions without Composer
On this page you can find all versions of the php package codekandis/regular-expressions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codekandis/regular-expressions
More information about codekandis/regular-expressions
Files in codekandis/regular-expressions
Package regular-expressions
Short Description `codekandis/regular-expressions` is a library to provide regular expression interfaces and classes.
License MIT
Informations about the package regular-expressions
codekandis/regular-expressions
codekandis/regular-expressions
is a library to provide regular expression interfaces and classes.
Index
- Installation
- Testing
- How to use
RegularExpression::match()
RegularExpression::matchAll()
RegularExpression::replace()
Installation
Install the latest version with
Testing
Test the code with
How to use
RegularExpression
wraps several PHP RegEx functions. The description to the paramters used can be read in the PHP manual linked in the description of the respective methods. The parameter [$throwNoMatchException
][] is described below
Instanziation
The pattern must be passed to the constructor of the RegularExpression
.
If the passed pattern is invalid an InvalidRegularExpressionException
will be thrown.
RegularExpression::match()
preg_match()
.
This method provides a parameter $throwNoMatchException
. It defaults to true
. If the regular expression does not match to the subject a RegularExpressionNotMatchingException
will be thrown. If the parameter $throwNoMatchException
is set to false
the method returns null
.
Passing an invalid offset throws an InvalidOffsetException
.
RegularExpression::matchAll()
preg_match_all()
.
This method provides a parameter $throwNoMatchException
. It defaults to true
. If the regular expression does not match to the subject a RegularExpressionNotMatchingException
will be thrown. If the parameter $throwNoMatchException
is set to false
the method returns null
.
Passing an invalid offset throws an InvalidOffsetException
.
RegularExpression::replace()
preg_replace()
.
This method provides a parameter $throwNoMatchException
. It defaults to true
. If the regular expression does not match to the subject a RegularExpressionNotMatchingException
will be thrown. If the parameter $throwNoMatchException
is set to false
the method returns the passed subject instead.
Passing an invalid limit throws an InvalidLimitException
.