I have this pattern which finds links, inside a text string from file_get_contents function.

Works fine, it seems. But I am curious to understand the expression, each charachter of it, what it does etc.

Here you go:

preg_match_all('~href=("|\')(.*?)\1~', $var, $out);

I know what it does obviously, but what does (.*?)\1~ do?

What does this ~ mean? Is that just the start and end delimeter used i this case? So that could also be // (start, end)?

Finally, any good simple source where I can read up on these expressions, from beginner to more advanced level?

All the best, Klemme

Here's another website with good explanations.

Thank you, I will read up on it :-)