Regular expression for finding words beginning with a dollar-sign


#1

Just wanted to confirm that the correct way to catch all tweets that contain words that begin with a dollar-sign and contain 2-4 uppercase english alphabet characters is:

  interaction.type == "twitter" and interaction.content regex_partial "\\$[A-Z]{2,4}"

Did I get the escaping right? Is the number of back-slashes correct?

Thanks
L


#2

This is correct.

You may want to change [A-Z] to [a-zA-Z] to include both upper and lower case characters. Regular expressions in DataSift use the Google RE2 regular expression syntax.