I've got information that is imported from a CSV file that my site grabs every day with PHP. I'm just learning RegEx so I'm able to do what I need to do but am looking to get more efficient with my coding.
Some of example of the kinds of strings that would come in would be:
15 SE NORFOLK 5 NNE OAKLAND 1 S LOS ANGELES 1 NW SACRAMENTO BOSTON
It's basically numbers then directional letters then city name. Sometimes there aren't numbers and letters so I'm checking to see first and then just deleting them with
preg_replace if there are (I just need the city name).
Here's the expression I have that works:
$location = preg_replace('/^[\d]+[\s]+[a-zA-z]+[\s]/', '', $string);
I know with regex there are a bunch of different ways to different things so I'm curious if there's a more efficient way to do what I'm doing.