How do I get substring from string which start with s and end with /s.
$text can be in following formats
$text = "LowsABC/s";
$text = "sABC/sLow";
$text = "ABC";
how can I get ABC, sometime it may happen that $text does not contain s and /s just only ABC, Still I want to get the ABC.
The regular expression:
Or when you want to get a string of minimal length:
And apply this res you can using
preg_match:And now you must check, if something was found or not, and if not,
then the result must be set to the entire string:
Example of usage: