pattern()->match() you can:
- Test a subject against a pattern:
- Retrieve matches from the subject:
- Get capturing groups from matches:
- Invoke callbacks for matches:
Test a subject
If you only need to check whether a pattern matches a subject, use:
...or to check whether it doesn't:
pattern()->match() throws an exception if the pattern is invalid (or in case of any other error).
You can also use
You can easily retrieve matched occurrences of a pattern in your subject.
You can limit your matches with
To get the first occurrence of a matched pattern, call
If you call
only() on a subject that doesn't match your pattern, you'll receive an empty array.
If, however, subject doesn't match your pattern and you use
SubjectNotMatchedException is thrown.
Protect the developer
Please, keep in mind that T-Regx aims to relieve you (a programmer) from any brain strain, therefore if you