tags:

views:

48

answers:

1

I have some strings that need a-strippin':

ÃœT: 9.996636,76.294363

Tons of long strings of location codes. A literal regex in PHP won't match them, IE

$pattern = /ÃœT:/;
echo preg_replace($pattern, "", $row['location']);

Won't match/strip anything. (To know it's working, /T:/ does strip the last bit of that string). What's the encoding error going on here?

Alternately, I would accept a concise way to take out just the numbers.

+2  A: 

If the text is all in that format (: followed by a space) you can probably just say:

$str = explode(": ", $pattern);
echo($str[1]);

It's not the most elegant solution per-se and I have no idea if this is incredibly slow, but it works for most things. Unless you're hell bent on using regular expressions that is.

Josh K