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


Groups > comp.lang.javascript > #7718

Replace in String

From "Shapper." <mdmoura@gmail.com>
Newsgroups comp.lang.javascript
Subject Replace in String
Date 2011-10-27 04:04 -0700
Organization http://groups.google.com
Message-ID <3856471.2893.1319713450524.JavaMail.geo-discussion-forums@yqnx19> (permalink)

Show all headers | 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