Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #31933
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: RegExp question |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <9e17dd7e-f5d5-4e92-b8ce-0766d84849cc@googlegroups.com> |
| Date | 2016-12-21 09:55 +0100 |
| Message-ID | <XnsA6E564EF8627Deejj99@194.109.6.166> (permalink) |
justaguy <lichunshen84@gmail.com> wrote on 21 Dec 2016 in
comp.lang.javascript:
>
> I'm processing some text files. On average its size is between 50 to
> 70k. I first read a text file into a variable.
> Then, loop through the variable with line as its delimiter.
>
> And I turn the body of the text with line breaks into HTML <BR>, prefix
> with <html><body> and add footer of </body></html>. All this is done
> via a third party, server scripting language.
>
> The result HTML renders fine with both Firefox and Chrome though its
> entire content is on a single line. And maybe that's single line is a
> source of problem... (I don't know).
>
> I then apply some logic and attempt to turn some phrases, i.e.
> "immune system", into HTML link (here's the Problem, most of the
> findings/terms/phrases were not replaced into what is supposed to be,
> see more below).
>
>
> Sample paragraph of the text:
> "
> Understanding the intimate relations between the immune system and the
> carcinogenesis process is an old research line in immunology. In the
> late nineteenth century, Coley had indeed demonstrated that infection
> triggered by bacterial toxins-based treatment promoted tumor regression
> by stimulation of the immune system [1,2]. Still, it remains a
> challenging field of research as new interrelations are continuously
> discovered and the more we know, the more complex it looks. "
>
> Server side code
What serverside language?
> of attempting to turn some phrase into a link:
> <cfset cn = "<span style='color:##7A30A0'> <a
> href='morePoints.cfm?t=#URLencodedFormat(cName)#'
> target='_new'>#cName#</a> </span>"> <cfset newbody =
> replace(newbody,'#cName#','#cn#','all')>
>
> Question, what's the RegExp syntax for the above #cn#, namely, {new
> string}? the #cname# variable being the {string to be replaced}, fyi,
> the third party server side scripting language's function is REreplace,
> currently I'm not using it because I don't know RegExp.
Do you have a Javascript Q?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
RegExp question justaguy <lichunshen84@gmail.com> - 2016-12-20 17:58 -0800 Re: RegExp question "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-21 09:55 +0100
csiph-web