in reply to Re: Advanced regular expression help
in thread Advanced regular expression help

As moritz suggested. Anyway if you want to use regex and just want to see $1 and $3 try to make the optional part capturing since you don't care about $2. Something like this:
my $regex = '<div id="aaaa">([.\w\s]*?)(<ul id="ccc">[.\s\w]*?</ul>)?( +[.\s\w]*?)</div>';
This is the output if that's what you seek:
Text 1 found text tex text more text Text 2 found text text text more text

Regards
s++ą  ł˝ ął. Ş ş şą Żľ ľą˛ş ą ŻĽąş.}++y~-~?-{~/s**$_*ee