There is a construction that parses the /start command in a telegram bot with parameters.
$command = '/start 123'; $regex = '/(\/start\s)(\d+)/'; if(preg_match($regex, $command, $match)) { echo 'start with parameter detected'; } How do I specify in a regular expression that (\d+) an optional parameter? What would you catch like /start or /start 123 ?
?) After a group with a number, a regular expression can have the following form:\/start\s(\d+)?- Let's say Pie