Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18091
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Need regexp help |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <eed9c2f1-0e66-4502-849d-9d538eddd1a8@googlegroups.com> <d1e1f8d6shakdd5sjro0vcudj1utmsa4q7@4ax.com> <vcr1f8ptnnqptopbi07esct071uuo38htl@4ax.com> <16779241.CEys5BfS3R@PointedEars.de> |
| Date | 2013-01-12 16:27 +0100 |
| Message-ID | <XnsA146A779FFBAeejj99@194.109.133.133> (permalink) |
Thomas 'PointedEars' Lahn wrote on 12 jan 2013 in comp.lang.javascript: >> var ind = haystack.indexOf(needle); >> var newstring = >> haystack.substring(0,ind)+haystack.substring(ind+needle.length); > > The key word here is ƒ oallƒ . Your code would replace only *one* > occurrence, so to replace *all* occurrences you would need to run it > in a loop. Probably a simpler way is to extract the part you want, instead of trying to delete all the stuf you do not want. If you only want the body's content, and you know the body has both a single and clean <body>, and a </body>: s = s.split(/<body>/)[1].split(/<\/body>/)[0]; Not tested. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Need regexp help justaguy <lichunshen84@gmail.com> - 2013-01-11 17:01 -0800
Re: Need regexp help Richard Yates <richard@yatesguitar.com> - 2013-01-11 17:14 -0800
Re: Need regexp help Richard Yates <richard@yatesguitar.com> - 2013-01-11 21:00 -0800
Re: Need regexp help Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-12 16:16 +0100
Re: Need regexp help "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-12 16:27 +0100
Re: Need regexp help Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-13 00:49 +0100
Re: Need regexp help Luc Yen <luc@goal.tw> - 2013-01-11 22:10 -0800
Re: Need regexp help "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-12 09:25 +0100
Re: Need regexp help justaguy <lichunshen84@gmail.com> - 2013-01-12 06:33 -0800
Re: Need regexp help justaguy <lichunshen84@gmail.com> - 2013-01-12 10:22 -0800
Re: Need regexp help justaguy <lichunshen84@gmail.com> - 2013-01-12 10:48 -0800
Re: Need regexp help SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2013-01-13 22:02 +0100
Re: Need regexp help "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-12 23:11 +0100
csiph-web