Parsing text and adding links for email and URLs

Is there a nice, pretty PHP function somewhere that will take in a long text string and parse it so all URLs and email addresses not already contained in HTML tags are turned into live links?

Thanks. If one exists, it'll save me hours of painful regex work.