Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #7718

Replace in String

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From "Shapper." <mdmoura@gmail.com>
Newsgroups comp.lang.javascript
Subject Replace in String
Date Thu, 27 Oct 2011 04:04:10 -0700 (PDT)
Organization http://groups.google.com
Lines 23
Message-ID <3856471.2893.1319713450524.JavaMail.geo-discussion-forums@yqnx19> (permalink)
Reply-To comp.lang.javascript@googlegroups.com
NNTP-Posting-Host 79.169.39.162
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1319714257 22917 127.0.0.1 (27 Oct 2011 11:17:37 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Thu, 27 Oct 2011 11:17:37 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=79.169.39.162; posting-account=3lVHLwoAAADAMy5OfB0ccr0KejM8Gq_l
User-Agent G2/1.0
X-Google-Web-Client true
Xref x330-a1.tempe.blueboxinc.net comp.lang.javascript:7718

Show key headers only | View raw


Hello,

I have the following:

  var original = "<span>name at email dot com</span>"
  var at = "at";
  var dot = "dot";

  email = original.text().replace(new RegExp(' ' + at + ' ', 'gi'), '@').replace(new RegExp(' ' + dot + ' ', 'gi'), '.');

  I need to find the at and dot var values in original and replace by @ and .

  And I need to be case insensitive. So could be AT.
  Or any other thing like var at = "ATE".

  My Regex expression is not replacing anything.

  What am I doing wrong?

-- 
 
Thank You,
Miguel

Back to comp.lang.javascript | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Replace in String "Shapper." <mdmoura@gmail.com> - 2011-10-27 04:04 -0700
  Re: Replace in String "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-10-27 14:46 +0300

csiph-web