Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace a word with another

Status
Not open for further replies.

damipera

Technical User
Dec 1, 2005
134
GB
hi guys how do i replace dynamically the words from the dynamically-generated contents to some other string in asp.net vb?

e.g.

from this:
Japan is an archipelago of 6,852 islands.[8] The four largest islands are Honsh?, Hokkaid?, Ky?sh? and Shikoku, together accounting for 97% of Japan's land area. Most of the islands are mountainous, many volcanic...

to this:
Japan is an <a href="map.jpg">archipelago</a> of 6,852 islands.<a href="reference.aspx">[8]</a> The four largest islands are <a href="honshu.jpg">Honsh?</a>, Hokkaid?, Ky?sh? and Shikoku, together accounting for 97% of <a href="japan.aspx">Japan's</a> land area. Most of the islands are mountainous, many <a href="fuji.jpg">volcanic</a>...

any ideas is appreciated.

thanks



 
1st, translating text from A to B has nothing to do with asp.net. all asp.net does is send an http response for every http request. anything else is outside the scope of what asp.net is meant to do. you will most likely use this with a website driven by asp.net, but the actual substitution process is independent of that.

if this can be done...
with 100% accuracy, no. for that you would need a template to generate the source. from the source template you could transform that into the destination text.
at best you would need a document indexing database of some sort (like lucene.net) and then some of your own code to translate keywords into specific links. you could then tweak the indexing to get the results you want, configuring that will be a very manual process.

you're other option is to manually map the text somehow, but that requires human intervention for every block of text.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
how about asp.net replace function, Regular Expression Class?
 
what patterns do you see in the paragraph of text? regex would work if you can find them. I don't see any templates or patterns that regex would understand.

asp.net handles http request/response. regular expressions are patterns of text. they are not specific to asp.net. you could ask the same question in the vb.net forum and the results (if any) would be the same. parsing text is not specific to asp.net.



Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
yes i got you, i just want to ask how am i able to do that in .net? (in reference to my first post.)
 
@mayamanako
how are you able to do what in .net? wrap keywords with links to specific pages? you either need a pattern to recognize, or a template to build the final result. the text
Japan is an archipelago of 6,852 islands.[8] The four largest islands are Honsh?, Hokkaid?, Ky?sh? and Shikoku, together accounting for 97% of Japan's land area. Most of the islands are mountainous, many volcanic...
doesn't appear to have either to build
Japan is an <a href="map.jpg">archipelago</a> of 6,852 islands.<a href="reference.aspx">[8]</a> The four largest islands are <a href="honshu.jpg">Honsh?</a>, Hokkaid?, Ky?sh? and Shikoku, together accounting for 97% of <a href="japan.aspx">Japan's</a> land area. Most of the islands are mountainous, many <a href="fuji.jpg">volcanic</a>...
as i see it; you can't.


Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top