To regex, or not to regex?
Posted: Mon Dec 15, 2003 4:24 pm
Whole mess of crap to deal with, try to stay with me here...
The server I'm working with doesn't allow any htaccess changes, so to keep URLs somewhat user-friendly, I'm extracting the query string, and using what's in there as a variable, rather than full-out URL variable passing.
i.e. ?home instead of ?page=home
That much I have set up without a problem. The problem is when there is another variable in the query string (which happens if someone wants to switch the stylesheet). The query string ends up looking like this:
?home&s=1
It picks up s=1 okay, but doesn't know what to do with home, and the query string is taken as "home&s=1," which isn't a valid page, obviously. What I want to do is have it find "home" (I suppose it would consider this a variable without a value).
Having very little experience with regular expressions, I'm not sure if they have the capability I'm looking for (although, from what I understand, it makes sense that they would). What I'm asking is, how would I set up the expression to search for an unknown value?
Lot of explanation for one question, huh?
The server I'm working with doesn't allow any htaccess changes, so to keep URLs somewhat user-friendly, I'm extracting the query string, and using what's in there as a variable, rather than full-out URL variable passing.
i.e. ?home instead of ?page=home
That much I have set up without a problem. The problem is when there is another variable in the query string (which happens if someone wants to switch the stylesheet). The query string ends up looking like this:
?home&s=1
It picks up s=1 okay, but doesn't know what to do with home, and the query string is taken as "home&s=1," which isn't a valid page, obviously. What I want to do is have it find "home" (I suppose it would consider this a variable without a value).
Having very little experience with regular expressions, I'm not sure if they have the capability I'm looking for (although, from what I understand, it makes sense that they would). What I'm asking is, how would I set up the expression to search for an unknown value?
Lot of explanation for one question, huh?