Ask a Question related to PERL Miscellaneous, Design and Development.
-
Seansan #1
Matching URls
Hi,
Does anyone know of a link to or an example of a decent regexp that wil
recognize internet URLs? (It needs to match urls starting with http:// and
[url]www.)[/url]
I am trying to replace a string like
"My Homepage is @ http://www.homepage.nl"
with
"My Homepage is @ <A HREF =
'http://www.homepage.nl'>http://www.homepage.nl</A>"
Thx, Seansan
Seansan Guest
-
can you please checkout these urls
Can you please checkout these URLs http://images.optin.com.au/optusxmas/flash/penguin_tebe.swf?msg=satish http://www.diesel.com/ When we observe... -
iframe URLS
Hi, I was wondering whether it was possible to define a URL which links to a page containing and iframe and define which src to display in the... -
dynamic URLS convert to static URLS for search engines
We use ASP.net and all our pages are dynamically created and search engines such as Google does not like dynamically created pages to index. What is... -
Different urls to same ws?
Hi! We are developing a web service that needs to use several databases (each company that uses this web service has their own database). Is it... -
Send me you URLs
"Give me your tired, your poor, Your huddled masses yearning to breathe free, The wretched refuse of your teeming shore. Send these, the homeless,... -
Tina Mueller #2
Re: Matching URls
Seansan wrote:
perldoc URI::Find> Does anyone know of a link to or an example of a decent regexp that wil
> recognize internet URLs? (It needs to match urls starting with http:// and
> [url]www.)[/url]
and
perldoc URI::Find::Schemeless
hth, tina
--
[url]http://www.tinita.de/[/url] \ enter__| |__the___ _ _ ___
[url]http://Movies.tinita.de/[/url] \ / _` / _ \/ _ \ '_(_-< of
[url]http://www.perlquotes.de/[/url] \ \ _,_\ __/\ __/_| /__/ perception
- my mail address expires end of august 2003 -
Tina Mueller Guest
-
Jeff 'japhy' Pinyan #3
Re: Matching URls
On 20 Jul 2003, Tina Mueller wrote:
Damn those URIs and their zany schemes.>Seansan wrote:
>>>> Does anyone know of a link to or an example of a decent regexp that wil
>> recognize internet URLs? (It needs to match urls starting with http:// and
>> [url]www.)[/url]
>perldoc URI::Find
>and
>perldoc URI::Find::Schemeless
--
Jeff Pinyan RPI Acacia Brother #734 2003 Rush Chairman
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
Jeff 'japhy' Pinyan Guest
-
JR #4
Re: Matching URls
"Seansan" <sheukels=cuthere=@yahoo.co.uk> wrote in message news:<3f1aa893$0$61643$e4fe514c@dreader3.news.xs4a ll.nl>...
## I think this is what you want. Good luck.> Hi,
>
> Does anyone know of a link to or an example of a decent regexp that wil
> recognize internet URLs? (It needs to match urls starting with http:// and
> [url]www.)[/url]
>
> I am trying to replace a string like
> "My Homepage is @ http://www.homepage.nl"
> with
> "My Homepage is @ <A HREF =
> 'http://www.homepage.nl'>http://www.homepage.nl</A>"
>
> Thx, Seansan
## JR
#!/perl
use strict;
use diagnostics;
use warnings;
while(<DATA>) {
s/(http:\/\/www.*)\b/<a href='$1'>$1<\/a>/g;
print $_, "\n";
}
__DATA__
My homepage is @ [url]http://www.homepage.nl[/url]
My favorite site is @ [url]http://www.espn.com[/url]
My second most favorite site is @ [url]http://www.whatever.org[/url]
=pod
## OUTPUT
My homepage is @ <a href='http://www.homepage.nl'>http://www.homepage.nl</a>
My favorite site is @ <a
href='http://www.espn.com'>http://www.espn.com</a>
My second most favorite site is @ <a
href='http://www.whatever.org'>http://www.whatever.org</a>
=cut
JR Guest
-
Bob Walton #5
Re: Matching URls
Seansan wrote:
....
....> Does anyone know of a link to or an example of a decent regexp that wil
> recognize internet URLs? (It needs to match urls starting with http:// and
> [url]www.)[/url]
You could:> Thx, Seansan
use Regexp::Common::URI;
--
Bob Walton
Bob Walton Guest
-
Bob Walton #6
Re: Matching URls
Bob Walton wrote:
....Make that:> You could:
>
> use Regexp::Common::URI;
>
use Regexp::Common qw(URI);
--
Bob Walton
Bob Walton Guest
-
Seansan #7
Re: Matching URls
Thx JR (and others),
I tried it, and it works. But I only have 1 problem:
*) It matches all the text after the url as well."My String: "Homepage is @
[url]http://www.homepage.nl[/url], yep thats it" becomes
"Homepage is @ <A HREF=http://www.homepage.nl yep thats
it>[url]http://www.homepage.nl[/url] yep thats it</A>"
Any ideas on how to solve this? I played witht he regexp a while, but I cant
figure it out.
ps. How would I alter the regexp to match www. also? Like this?
s/([http:\/\/www|www].*)\b/<a href='$1'>$1<\/a>/g;
Seansan
"JR" <jrolandumuc@yahoo.com> wrote in message
news:b386d54b.0307200940.b8ef6b9@posting.google.co m...news:<3f1aa893$0$61643$e4fe514c@dreader3.news.xs4a ll.nl>...> "Seansan" <sheukels=cuthere=@yahoo.co.uk> wrote in messageand> > Hi,
> >
> > Does anyone know of a link to or an example of a decent regexp that wil
> > recognize internet URLs? (It needs to match urls starting with http://href='http://www.homepage.nl'>http://www.homepage.nl</a>>> > [url]www.)[/url]
> >
> > I am trying to replace a string like
> > "My Homepage is @ http://www.homepage.nl"
> > with
> > "My Homepage is @ <A HREF =
> > 'http://www.homepage.nl'>http://www.homepage.nl</A>"
> >
> > Thx, Seansan
> ## I think this is what you want. Good luck.
> ## JR
>
> #!/perl
> use strict;
> use diagnostics;
> use warnings;
>
> while(<DATA>) {
> s/(http:\/\/www.*)\b/<a href='$1'>$1<\/a>/g;
> print $_, "\n";
> }
>
> __DATA__
> My homepage is @ [url]http://www.homepage.nl[/url]
> My favorite site is @ [url]http://www.espn.com[/url]
> My second most favorite site is @ [url]http://www.whatever.org[/url]
>
> =pod
> ## OUTPUT
>
> My homepage is @ <a> My favorite site is @ <a
> href='http://www.espn.com'>http://www.espn.com</a>
> My second most favorite site is @ <a
> href='http://www.whatever.org'>http://www.whatever.org</a>
>
> =cut
Seansan Guest
-
Patrick LeBoutillier #8
Re: Matching URls
"Seansan" <sheukels=cuthere=@yahoo.co.uk> wrote in message news:<3f1aa893$0$61643$e4fe514c@dreader3.news.xs4a ll.nl>...
Check out the Regexp::Common module. I think it has what you are looking for.> Hi,
>
> Does anyone know of a link to or an example of a decent regexp that wil
> recognize internet URLs? (It needs to match urls starting with http:// and
> [url]www.)[/url]
>
> I am trying to replace a string like
> "My Homepage is @ http://www.homepage.nl"
> with
> "My Homepage is @ <A HREF =
> 'http://www.homepage.nl'>http://www.homepage.nl</A>"
>
> Thx, SeansanPatrick LeBoutillier Guest
-
Abigail #9
Re: Matching URls
Seansan (sheukels=cuthere=@yahoo.co.uk) wrote on MMMDCX September
MCMXCIII in <URL:news:3f1aa893$0$61643$e4fe514c@dreader3.news. xs4all.nl>:
\\ Hi,
\\
\\ Does anyone know of a link to or an example of a decent regexp that wil
\\ recognize internet URLs? (It needs to match urls starting with http:// and
\\ [url]www.)[/url]
\\
\\ I am trying to replace a string like
\\ "My Homepage is @ http://www.homepage.nl"
\\ with
\\ "My Homepage is @ <A HREF =
\\ 'http://www.homepage.nl'>http://www.homepage.nl</A>"
use Regexp::Common qw /URI/;
$str =~ s!($RE{URI}{HTTP})!<a href = '$1'>$1</a>!g;
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
..qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
..qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
Abigail Guest



Reply With Quote

