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 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 Link to comment https://forums.phpfreaks.com/topic/265240-optional-last-parameter/#findComment-1359320 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.