You are here:  » Help with Parsing a value using regex...


Help with Parsing a value using regex...

Submitted by terencef on Sat, 2011-02-19 16:02 in

Hi David; I'm having a tough time with parsing the GUID from the twiter status value 38939353681628672 from

http://twitter.com//statuses/38939353681628672

using preg_match("/[0-9]*$", $value, $matches)

I'm not a hard-code programmer - could you suggest the right match expr?

Thanks in advance

Submitted by support on Sat, 2011-02-19 18:28

Hi Terence,

Where the format is completely predictable I would use string functions rather than a regexp. Assuming the above is in your $value, have a go with something like this:

  $parts = explode("/",$value);
  $guid = $parts[count($parts)-1];

Cheers,
David.