The Altair Community is migrating to a new platform to provide a better experience for you. The RapidMiner Community will merge with the Altair Community at the same time. In preparation for the migration, both communities are on read-only mode from July 15th - July 24th, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here.

Regex to extract Twitter handles from post

esboylesesboyles Member Posts: 2 Contributor I
edited December 2018 in Help

Searching high and low for a regex to use with a Generate Attributes operator to pull @handle from twitter posts.

Anyone have an efficient and accurate expression that can do that?

Note, there might be multiple @handles so I want them all.

Many thanks.



  • Options
    Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    I do all that within Text Processing as part of the tokenization, but if you want to extract to do it on a tweet level I would use one of the Replace type operators with a capturing group. 

  • Options
    esboylesesboyles Member Posts: 2 Contributor I

    The search continues... trying this in a Generate Attibute operator.  (?:\s|\A)[##]+([A-Za-z0-9-_]+) thinking that I would start with generating hashtags to a store for later analysis.


    This checks out on but when implemented as an expression, RM states a Token recognition error at ?

    Any tips on making this seemingly simple approach work? Does RM impelment the Java Regex specification or something else?






  • Options
    sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager

    hi @esboyles - so a quick search here on the community for "regex not working" revealed a nice post by Ingo where he talks about the differences between javascript regex parser vs java regex parser:



Sign In or Register to comment.