Given a string like:
"@[19:Sara Mas] what's the latest with the TPS report? @[30:Larry Peters] can you help out here?"
I want to find a way to dynamically return, the user tagged and the content surrounding. Results should be:
user_id: 19
copy: what's the latest with the TPS report?
user_id: 30
copy: can you help out here?
Any ideas on how this can be done with ruby/rails? Thanks
How is this regex for finding matches?
@\[\d+:\w+\s\w+\]
This grabs id and content in backreferences 1 and 2 respectively. For stoping the capture either @ or the end of string must be met.
This will match something starting from @ and ending to punctuation makr. Sorry if I didn’t understand correctly.