I have a regex here
Code: Select all
"#<([a-z0-9-_]+?)>(.*?)</\\1>#is"But I want to handle nested tags like <hello><world>some text</world></hello>, and I now need to find a way to
let it match tags that do NOT contain any other tags inside them, like the first example.
I presume I'll have to exclude it from the (.*?) group, but I don't know how to implement it.
I tried
Code: Select all
"#<([a-z0-9-_]+?)>([^(<([a-z0-9-_]+?)>(.*?)</\\1>)]*?)</\\1>#is"Any help is appreciated,
S.