2

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.

1
  • 1
    You see all of these letters I am typing? They are all pretty weird to me. Commented Apr 21, 2010 at 3:43

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to use the /u modifier on your regex to work with unicode

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.