Reputation: 11
I'm trying to extract multiple twitter handles in a google sheet, like that :
Lorem Lorem Lorem @Handle1 Lorem Lorem Lorem Lorem Lorem Lorem
Lorem Lorem LoremLorem Lorem Lorem @Handle2 Lorem Lorem Lorem @Handle3
What i want (extracted in the same cell) :
@Handle1
@Handle2
@Handle3
How i can do ?
Cheers
Upvotes: 1
Views: 104
Reputation: 1
=JOIN(CHAR(10), QUERY(TRANSPOSE(SPLIT(A1," ")),
"select Col1 where Col1 contains '@'", 0))
Upvotes: 0
Reputation: 1
=REGEXEXTRACT(A1, "(@\w*)")&" "&JOIN(" ", REGEXEXTRACT(A1, "(@\w*).*(@\w*)"))
=REGEXEXTRACT(A1, "(@\w*)")&CHAR(10)&JOIN(CHAR(10), REGEXEXTRACT(A1, "(@\w*).*(@\w*)"))
Upvotes: 0
Reputation: 43189
You could use
@\w+
@\w+ # @-sign + word characters
Lookarounds seem not to be supported by re2
(see here for more information).
Upvotes: 0