el_pup_le
el_pup_le

Reputation: 12189

URL parsing in PHP

Do any PHP parsers exist that get all urls out of a string? I'd like an alternative to regex for getting all urls out of a string.

Update:

    $urls = "http://stackoverflow.com/question
             http://stackoverflow.com/questions";

    //no space between urls
    $urls = "http://stackoverflow.com/questionshttp://stackoverflow.com/questiond";

Upvotes: 1

Views: 334

Answers (1)

Caffeinated
Caffeinated

Reputation: 12484

There is no very-easy alternative to regex. But It has been solved using regex already, see Extract URLs from text in PHP and PHP validation/regex for URL .

Regex is quite useful though. Perl and Javascript and Java, etc etc

Upvotes: 1

Related Questions