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;
}

#indieweb - #programming - #regex

From JR's : articles
34 words - 365 chars
created on - #
source - versions

Related articles
Perl regex extracting domain name from URL code example - Oct 02, 2013
Indieweb links aug 29, 2016 - Aug 29, 2016
Perl regex extracting domain name from URL - Oct 02, 2013
Will Twitter eliminate its 140-character post limit? - Mar 16, 2015
July 2016 ToDo - Implement Micropub spec in JavaScript editor - Jul 14, 2016
more >>



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: Nov 30, 2021 - 5:00 p.m. EST