actually regular

preg_match('%^(\w+)(/(\w+)+[+'])?$%', $pathInfo, $matches) 

that's what I'm trying to catch

 serials/mul使tfil使m 
  • '%^(\w+)/([\w使]+)?$%' , if the parser breaks the quote, replace it yourself. Work example - Mi Ke Bu
  • @MiKeBu do not be offended but instead of answering just try phpliveregex.com here - Sergalas
  • Please) your service also gives out the correct one - phpliveregex.com/p/g4M - Mi Ke Bu
  • exactly gives out and what is this sign? - Sergalas
  • This is the strange quotation that I copied from mul使tfil使m . Maybe your quotes were similar, and Unicode codes were different - Mi Ke Bu

1 answer 1

Decision

The search will take the form:

 preg_match('%^(\w+)/([\w使]+)?$%', $pathInfo, $matches) 

Change - the second part consists of a set of specified characters, where the necessary special characters are clearly written.

Work examples

regex101 , phpliveregex