Using Regular Expression In Twitter Api
Solution 1:
Twitter unfortunately doesn't support searching of tweets using regular expressions which means that you do have to post process. There's not actually any official documentation from Twitter to that effect, but everyone who uses the Twitter search API post-processestheir tweets using regex (including me). Since there isn't a stated official position, I've tried just about every flavor of regex in search queries but I've had no luck. Per the Twitter search API documentation, queries must be:
A UTF-8, URL-encoded search query of 1,000 characters maximum, including operators. Queries may additionally be limited by complexity.
All queries are UTF-8 and are obviously searched as such. It'd be nice if there was a regex parameter we could specify in the API search call but there isn't.
The reason behind this is likely the additional processing cost that running a regex search on all tweets would have for Twitter itself.
Solution 2:
There is now a full list of all available search operators in the Twitter API documentation.
https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/standard-operators
I can't comment on the original answer, so thought this would be useful for future visitors arriving via Google, as it is not easy to find on the Twitter docs website.
Post a Comment for "Using Regular Expression In Twitter Api"