I wanted to know what this $ means in the definition of the routes, for example:
route["(.*)-sid-(:num)-(:num)"] = "services/service/$2/$3";
What does $2
and $3
?
I wanted to know what this $ means in the definition of the routes, for example:
route["(.*)-sid-(:num)-(:num)"] = "services/service/$2/$3";
What does $2
and $3
?
These are groupings of characters captured from a Regular Expression or RegEx
.
In your case, CodeIgniter can define the routes with regular expression clusters within the parentheses, where: $route["(.*)-sid-(:num)-(:num)"] = "services/service/$2/$3";
, $2
and $3
represent respectively the numeric character groups (:num)
and (:num)
and $1
captures a group of characters if there is (.*)