Regex Trouble

Hey everyone,

I’m having a bit of trouble with some regex and I think I’m nearly there. Basically I need a rule which grabs whatever li element which doesnt contain a <ul> element.

So a match would be <li>hi</li> and not <li><ul><li>hi</li></ul></li>

Here’s what I have:

$str = preg_replace_callback('/(<li>([^<ul>]*)<\/li>)/', "sort_lists_regex", $str);

The current issue is that I dont know how to specify the NOT the string ‘<ul>’, as I’m currently saying NOT <, u, l, >

Help please! :confused: