How to track a hashtag containing ampersand (&) using twitter stream API? - twitter4j

I'm trying to track a hashtag using the twitter4j stream API. The hashtag contains an ampersand, e.g. #AT&T. I'm not getting any resultant tweet for that hashtag.
Is it possible to track such hashtags using streaming API?

Hashtags cannot contain a & character. I believe the only valid characters letters, numbers and underscore. If you try to search for #AT&T you will effectively be searching instead for #AT.

Related

how to remove tweets link inside mongo db

I have a set of tweets data in MongoDB. all tweets contain some bad expression like //,? or links. for example:
"text": "We\\'re through one end in 🇦🇺 Australia vs. 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland in the GOLD medal match of men\\'s triples! Get around the action 👉 https:12345567 #GC2018 #ShareTheDream https
How can I replace (remove) them? I tried to use remove() function but removing it is not good because it will remove the whole text. I just want to remove the bad words, but leave the text as it is
For special characters use str.replace(/[^a-zA-Z0-9]/g, "");.
Or you can specifiy each char you wish to remove string.replace(/[&\/\\#,+()$~%.'":*?<>{}]/g, '');
For URL's b = url.replace(/(?:https?|ftp):\/\/[\n\S]+/g, '');
Pay attention to escape character '\'.

Improper utf16 count for certain emoji's

Certain emoji's that are actually a combination of emoji's result in the incorrect (or at least a count that doesn't match websites like Twitter).
Example problem is pretty straight forward
👩‍⚖ <- this emoji is a female judge (woman + scale)
The count of this emoji is 1
the utf16 count of this emoji in Swift is 4
let tweet = "👩‍⚖"
print(tweet.utf16.count)
However, pasting this emoji into Twitter (which is an emoji that Twitter doesn't seem to support you are given the two emoji's. Woman & Scale. Woman is 2 characters and scale is 2 characters when using utf16 count. However, Twitter seems to have a hidden albeit counted invisible character. You will notice this when you try to delete the characters. I'm wondering if there's some way to properly match Twitters count when on mobile. I've seen other websites which, while properly showing the single emoji, are still getting the proper count.
Thanks.
Upgraded Twitter pod and used weighted length for the solution here.
https://developer.twitter.com/en/docs/developer-utilities/twitter-text
For those who end up here with a similar problem, Twitter recommends you show progress rather than exact counts by using permillage.

Algolia tag not searchable when ending with special characters

I'm coming across a strange situation where I cannot search on string tags that end with a special character. So far I've tried ) and ].
For example, given a Fruit index with a record with a tag apple (red), if you query (using the JS library) with tagFilters: "apple (red)", no results will be returned even if there are records with this tag.
However, if you change the tag to apple (red (not ending with a special character), results will be returned.
Is this a known issue? Is there a way to get around this?
EDIT
I saw this FAQ on special characters. However, it seems as though even if I set () as separator characters to index that only effects the direct attriubtes that are searchable, not the tag. is this correct? can I change the separator characters to index on tags?
You should try using the array syntax for your tags:
tagFilters: ["apple (red)"]
The reason it is currently failing is because of the syntax of tagFilters. When you pass a string, it tries to parse it using a special syntax, documented here, where commas mean "AND" and parentheses delimit an "OR" group.
By the way, tagFilters is now deprecated for a much clearer syntax available with the filters parameter. For your specific example, you'd use it this way:
filters: '_tags:"apple (red)"'

Facebook search manipulates keywords

When using the Facebook Graph API to search through public posts, it seems like Facebook malforms search terms in ways that are not obvious. For example, searching for 'coffee' will return only posts containing 'coffe' (mind the e). When searching for certain plural words ending with 's', Facebook removes the 's'. The problem now is that searching for certain non-English terms such as 'Wilders' (name of a person), will return results for the English word 'wilder'.
This has been asked to Facebook dev support but they claim it to be 'by design'. If this is by design however, I am wondering how I can actually search for 'coffee', 'carrots' or 'wilders' without getting my search terms malformed.
See also http://developers.facebook.com/bugs/336651873112920 and http://developers.facebook.com/bugs/591586327522090
If the last letter of each search word will be cut off, then try to add always one letter at the end of every word.

Regular expression to match all tags in HTML document in iPhone

I am developing an application in which I am using HTML documents.Now I want the user to be able to search for a word or phrase through all the documents so i planned to take all the text escaping tags in a string and search for the given word in the string.For that I want a regular expression to identify tags.Currently I am using following regular expression to identify tags:
NSString *regEx=#"<.*>";
I know its not a perfect choice.I want suggestions on what expression should I use so that I could identify tags in HTML.I am little confused about how to use escape sequence in the same.Any help is greatly appreciated.
Justin is correct.
I didn't find any such regular expression.