I'm trying to match all the quotes in the following example e-mail message:
> Don't forget to buy eggiweggs on the way home.
I shall not.
> Also remember to brush your shoes.
Will do.
> > > And clean up after the pigs.
> > But I have no pigs.
> Yes, you do. Your kids.
I see what you mean. They sure make a mess.
That means I want to match these three strings:
> Don't forget to buy eggiweggs on the way home.
And:
> Also remember to brush your shoes.
And:
> > > And clean up after the pigs.
> > But I have no pigs.
> Yes, you do. Your kids.
I don't understand how I can do this, since if I use the s flag to span multiple lines, which is required for this, I cannot refer to ^ and $ to mean "beginning of line" and "end of line" -- instead, they mean "beginning of string" and "end of string".
So if I do: #^(> .+?)$#us, it will match everything after/with the first quote.
And if I do: #^(> .+?)$#um, it will match only the first quote's first line and nothing else.
This is frustrating. I really have no idea how to solve it. I've searched online before asking and found zero even remotely relevant pages as usual.