I need a regex to match the the text between tags that are also nested between
tags - for example:
this text
I started using this: (?<=)[\s\S]*?(?=
) which does match the text between the header tag, I also started playing around with [\s\S]*?
to retrieve links which also works, but I am having problems when trying to combine the 2 together in one pattern.I might be going about this the wrong way altogether! I am new to regex and am still trying to learn, any help with this will be greatly appreciated!!
Krishna

Kirtan PatelRank #292 · 8.6K reputationPosted Oct 16, 2009, 5:24 AM EDT
Here is What you want
The ReGeX You want is below
(?<=
)[\s\S]*?(?=
)please dont forget to mark "Do you like this anwer" it is very important to me :-)
Roei BarRank #1,271 · 1.4K reputationPosted Oct 16, 2009, 5:22 AM EDT
http://kevin.deldycke.com/2007/03/ultimate-regular-expression-for-html-tag-parsing-with-php/
i think this is what you need :
(?<=
)[\S\s]*?(?=
)Kirtan PatelRank #292 · 8.6K reputationPosted Oct 16, 2009, 6:03 AM EDT
You Cheated ,
Why you copy pasted my regex to your post ???
at least if you cant answer dont copy paste others answer
I will complain about this to Mr mahesh
:X
K C3 reputationPosted Oct 16, 2009, 7:33 AM EDT
I ended up with this:
(?<=
[^>]*]*>)[\s\S]*?(?=[^>]*
)as I had a lot of characters in the href="" that I was not prepared for!
Thanks very much!!