I am a novice and am really struglling trying to come up with an expression that will locate 4 numbers adjacent to each other. For instance, given the following:
Jan. 1, 1980 -- December 31, 2002
I'd like to remove everything except the four digit years. Ultimately, I'd like to trun this string into:
19802002
I've tried the following:
preg_replace("/[0-9]{4}/", "", $string);
It's not working as I'd expect it to.... Can somebody please get me started in the right direction?