Hi, I only end up coming here once every 2 years so I guess I'm getting better* at php 😉
I have a string from the URL that looks like "2004/January/14" and a pattern of "20/y/" (the means any character that's not a slash).
Seeing whether that string matches the pattern is simple enough -- just turn the pattern into a regular expression by replacing the stars with "[/]*" and then use preg_match().
The problem is that I'd like to somehow get an array where the wildcards matched the url. Eg, with that previous example I want to be able to make an array of [0] = '04', [1] = 'Januar', [2] = '14'.
I've tried using preg_match_all() and this function does return all matches, but it returns "2004/January/14" because that's the match, and there doesn't seem to be a way of getting the individual wildcards.
I've been racking my brain about this all afternoon. Any ideas?
Should I just parse the string character by character myself?
*slacker