japhy has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to solve the following problem with a regex, and so far I have not been successful. I've mostly resigned myself to solving it without a regex, but I'd like to know if anyone here can come up with a clever solution.
Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
Nos autem praedicamus Christum crucifixum (1 Cor. 1:23) - The Cross Reference (My Blog)
I have a potentially malformed URL. It MAY be missing some of the leading characters of the "http://". That is, it might be tp://www.foo.com/ or ://www.foo.com; then again, it might be fine.
I am trying to determine WHAT I need to supply to the beginning of it. I know I could just do a check for ^http://, ^ttp://, ^tp://, and so on, but that seems so barbaric. Any ideas?
Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
Nos autem praedicamus Christum crucifixum (1 Cor. 1:23) - The Cross Reference (My Blog)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: What is missing from the beginning of this string? (direct)
by tye (Sage) on Oct 08, 2010 at 05:12 UTC | |
Re: What is missing from the beginning of this string?
by Marshall (Canon) on Oct 07, 2010 at 22:32 UTC | |
by japhy (Canon) on Oct 08, 2010 at 13:13 UTC | |
Re: What is missing from the beginning of this string?
by jakeease (Friar) on Oct 08, 2010 at 00:55 UTC | |
by aquarium (Curate) on Oct 08, 2010 at 03:51 UTC | |
Re: What is missing from the beginning of this string?
by dasgar (Priest) on Oct 07, 2010 at 23:00 UTC | |
by japhy (Canon) on Oct 08, 2010 at 00:47 UTC | |
by ambrus (Abbot) on Oct 09, 2010 at 09:22 UTC | |
Re: What is missing from the beginning of this string?
by ssandv (Hermit) on Oct 08, 2010 at 19:43 UTC |
Back to
Seekers of Perl Wisdom