Regex to grab ID from a Twitter post
https://github.com/jonnybarnes/posse/blob/master/src/Jonnybarnes/Posse/NotePrep.php
/**
* Grab the status id from a twitter URL
*
*/
public function replyTweetId($url)
{
$regex = '/https?:\/\/twitter.com\/[a-zA-Z_]{1,20}\/status\/([0-9]*)/';
preg_match($regex, $url, $match);
$id = $match[1];
return $id;
}
From JR's : articles
34 words - 365 chars
created on
- #
source
- versions
Related articles
Perl regex extracting domain name from URL - Oct 02, 2013
Will Twitter eliminate its 140-character post limit? - Mar 16, 2015
IndieWebCamp principles for building the indie Web - Oct 08, 2013
July 2016 ToDo - Implement Micropub spec in JavaScript editor - Jul 14, 2016
Regular Expressions with JavaScript - Dec 04, 2014
more >>