Andy-H Posted July 5, 2012 Share Posted July 5, 2012 I have the following regular expression, was just wondering if anyone knew of a way I could make the last forward-slash and parameter (radius) optional, thanks for any help ~^/shops/(?P<lat>([-+]?[0-9]*\.?[0-9]+))/(?P<lng>([-+]?[0-9]*\.?[0-9]+))/(?P<radius>([0-9]?))$~u Quote Link to comment https://forums.phpfreaks.com/topic/265240-optional-last-parameter/ Share on other sites More sharing options...
Andy-H Posted July 5, 2012 Author Share Posted July 5, 2012 Managed it: ~^/shops/?(?P<lat>([-+]?[0-9]*\.?[0-9]+))?/?(?P<lng>([-+]?[0-9]*\.?[0-9]+))?/?(?P<radius>([0-9]+?))?$~u Quote Link to comment https://forums.phpfreaks.com/topic/265240-optional-last-parameter/#findComment-1359320 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.