I'm trying to learn regex

Associate
Joined
6 Jul 2003
Posts
2,075
Take the following string:

(?<=<title.*>)([\s\S]*)(?=</title>)

This is designed to find the title tags and anything in between on a webpage, and it does. However, the title tags themselves aren't returned and I can't figure out why. I'd guess it's got to do with the (?<= ) and (?= ) but can't find out anywhere what these mean and why their difference (the greater-than symbol in the first) is significant.

Also, what's the difference between [\s\S]* and .* ?

Muchos gracias mon amigos!
 
Back
Top Bottom