aspose file tools
The moose likes Java in General and the fly likes replacing email address with email link Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "replacing email address with email link" Watch "replacing email address with email link" New topic
Author

replacing email address with email link

limpan luring
Greenhorn

Joined: Oct 23, 2004
Posts: 4
I want to do some filtering of raw text from text files or database entries to publish on a web site.
The problems include filtering out existing html tags, replacing email addresses with html email links, and creating html links from web addresses (starting with http )
The idea is to do it in a general enough way to make it easy to add and replace filters later on.

To start with I'd like input for howto make the replacements.
Has anyone done this in a good/not so good way?

[ October 24, 2004: Message edited by: limpan luring ]
[ October 24, 2004: Message edited by: limpan luring ]

Gentoo 2.6.9-r1<br />Tomcat 5.0.28
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
http://htmlparser.sf.net


Tony Morris
Java Q&A (FAQ, Trivia)
limpan luring
Greenhorn

Joined: Oct 23, 2004
Posts: 4
Thanx. Had a quick look at htmlparser, but it seems to be a bit overkill for my purposes.

Here's what I did (quick and dirty):

... and so on.
Applying these methods one after another (as is the idea behind the stuff) seems to be a bit inefficient, with all the String stuff going on. Any ideas on how to improve this? Not too sure about the regexps either ...
[ October 24, 2004: Message edited by: limpan luring ]
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
why reinvent the wheel?
You may think using an existing toolkit is overkill now but before you know you've rewritten over half the functionality...

As to email addresses: that's highly unreliable (unless your data is tabulated to tell you exactly where they are).
There's too many possible things that can go wrong.
is x@y.z an email address or not?
And what about a.b@c.e.f.g ?


42
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: replacing email address with email link
 
Similar Threads
I met Simon Roberts today
GMAIL
How do I get docroot from the servlet
next upgrade in a few days
Threads-Tutorial ??