Macro to extract markdown headers to emulate an annotation summary in Drafts for Mac

For my education and while we are on the topic, how would you edit this action to extract all bold or italics text.
Instead of 'starting with #' , one would extract all text contained between ** and ** or between * and *
I imagine that it is a question of changing LocalLine to something meaning text contained between (but could not find that option), and changing starts with but there again I could not find the right alternative.
thank you

image