Ah, that would be because RegExp is not jQuery. :)
Try this page. jQuery.attr doesn't return a String so that would certainly cause in this regard. Fortunately I believe you can just use .text() to return the String representation.
Something like:
$("li").val("title").search(/sometext/i));