473,505 Members | 15,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making URLS/E-Mails Into Links

Hello,

I'm outputting data from a flat-file into the browser, and I'd like to
output the URLs and E-Mails in link form.

The code now is simply this:
while (<FILE>) {
print "$_";
print "<br>";
}

How would I enhance this to make links out of e-mail addresses and URLs?
I'd appreciate any help.

Thanks!
Corey Martin
Jul 19 '05 #1
3 1733
JC
How 'bout this inside your while() loop?

if(m/\@/) {
print "<a href='mailto:$_'>$_</a>";
}
elsif(m/http/) {
print "<a href='$_'>$_</a>";
}

-jc
Corey Martin wrote:
Hello,

I'm outputting data from a flat-file into the browser, and I'd like to
output the URLs and E-Mails in link form.

The code now is simply this:
while (<FILE>) {
print "$_";
print "<br>";
}

How would I enhance this to make links out of e-mail addresses and URLs?
I'd appreciate any help.

Thanks!
Corey Martin


Jul 19 '05 #2
JC
One more thing to consider doing is chopping each line of the file.
-jc
How 'bout this inside your while() loop?

if(m/\@/) {
print "<a href='mailto:$_'>$_</a>";
}
elsif(m/http/) {
print "<a href='$_'>$_</a>";
}

-jc


Jul 19 '05 #3
Thanks!

"JC" <jw*********@verizon.net> wrote in message
news:f2***************@nwrdny03.gnilink.net...
One more thing to consider doing is chopping each line of the file.
-jc
How 'bout this inside your while() loop?

if(m/\@/) {
print "<a href='mailto:$_'>$_</a>";
}
elsif(m/http/) {
print "<a href='$_'>$_</a>";
}

-jc

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3401
by: phpkid | last post by:
Howdy I've been given conflicting answers about search engines picking up urls like: http://mysite.com/index.php?var1=1&var2=2&var3=3 Do search engines pick up these urls? I've been considering...
26
12378
by: Howard Brazee | last post by:
I would like to click on a URL of a html document that will open several URLs at once for me. Does someone have an example of a html document that will do this?
7
8293
by: AES | last post by:
Encountered a URL containing a comma the other day -- the first time I've ever noticed that, so far as I can recall. It worked fine, however, and I gather commas are legal in URLs. Out of...
10
1911
by: david | last post by:
Hi, all: I need a help from you about DataGrid control. I created a DataGrid, dg, in design view of .NET visual Stadio and use the builder to add a Hyperlink column to dg. I want to try to assign...
2
1323
by: laredotornado | last post by:
Hello, I want to take a block of text and add html tags to make hyperlinks where hyperlink strings exist. So, if I have a variable $a = "This is http://www.yahoo.com" I would like to run...
4
4584
by: rzimerman | last post by:
I'm hoping to write a program that will read any number of urls from stdin (1 per line), download them, and process them. So far my script (below) works well for small numbers of urls. However, it...
10
4893
by: jflash | last post by:
Hello all, I feel dumb having to ask this question in the first place, but I just can not figure it out. I am wanting to set my site up using dynamic urls (I'm assuming that's what they're...
9
5089
by: Salve =?iso-8859-1?Q?H=E5kedal?= | last post by:
What is the best regular expression for finding urls in plain text files? (By urls I mean http://www.something.com, but also www.something.com, or salve@somewhere.com) Salve
3
3853
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess...
4
4851
by: Guy Macon | last post by:
As a personal learning experience with limited practical use, I have been doing some experiments with using .htaccess to redirect mis-typed URLs to a preferred canonical form. I have set up a...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.