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
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
Perl regex extracting domain name from URL code example - Oct 02, 2013
Indieweb links aug 29, 2016 - Aug 29, 2016
more >>