[solved] How to extract specific format of text string? string format: r/subredditname

I generate answer from chatbot asking for subreddit suggestions for specific topic. The generated answers may not always be in a specific format but I could get them to strictly mention subreddits in the format r/subredditname

Chatbot may generate these subreddit names in any structure though. For example, they could be separated with new line, they could be separated by comma, there could be text before and after it in the same line etc

but one think is for sure, there would be a single space before and after the text string r/subredditname

so I want to use KM to extract subreddits list from the generated answer of chatbot in the following format:
r/subreddit1name
r/subreddit2name
r/subreddit3name
and so on..

How to do that?
Can regex be used? or python? or something else? or not possible at all? I am a non-programmer so no clue.

regexforsubreddit2024.kmmacros (5.7 KB)

Test the macro by manually putting value for the variable "subreddits_adulterated". I tested and it works. Hope this helps in case anyone come looking for it :stuck_out_tongue: