Common and useful classes, methods, exceptions etc.
Useful methods related to regular expressions
Class: Meritoo\Common\Utilities\Regex
File: src/Utilities/Regex.php
Returns slug for given value
string $value
- Value that should be transformed to slug
- value: non-scalar or
null
- result:
false
- value:
""
(an empty string) - result:
""
(an empty string)
- value:
"Lorem ipsum. Dolor sit 12.34 amet."
- result:
"lorem-ipsum-dolor-sit-1234-amet"
Clears, removes slash from the beginning of given string
string $string
- String that may contains slash as the 1st character
- string:
"lorem ipsum"
- result:
"lorem ipsum"
- string:
"/lorem ipsum"
- result:
"lorem ipsum"
- string:
"/ lorem 123 ipsum"
- result:
" lorem 123 ipsum"
Clears, removes slash from the end of given string
string $string
- String that may contains slash as the last character
- string:
"lorem ipsum"
- result:
"lorem ipsum"
- string:
"lorem ipsum/"
- result:
"lorem ipsum"
- string:
"lorem 123 ipsum /"
- result:
"lorem 123 ipsum "