473,403 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Global, Case-Insensitive replace()

hsriat
1,654 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. function repAll(t) {
  2.   var finds = new Array(......); //array of to-be-replaced strings
  3.   var repls = new Array(......); //array of replace-with strings
  4.   t = t.replace(finds[i], repls[i], 'gi');
  5. }
Working fine with FF, but not with IE, Opera and Safari...

How can I solve this?
Feb 20 '08 #1
4 2570
hsriat
1,654 Expert 1GB
Missed one line in the previous post.

Expand|Select|Wrap|Line Numbers
  1. function repAll(t) {
  2.   var finds = new Array(......); //array of to-be-replaced strings
  3.   var repls = new Array(......); //array of corresponding replace-with strings
  4.   for (var i=0; i<finds.length; i++)
  5.   t = t.replace(finds[i], repls[i], 'gi');
  6. }
Feb 21 '08 #2
acoder
16,027 Expert Mod 8TB
See this example.
Feb 21 '08 #3
hsriat
1,654 Expert 1GB
See this example.
I saw that already, but the difference is, they are using string itself, while I'm using reference. How could I add /gi to a referance?
Feb 21 '08 #4
acoder
16,027 Expert Mod 8TB
Use the RegExp object, e.g. see this link.
Feb 21 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Stan Sainte-Rose | last post by:
Hi, I need some help on this topic. I have a generic website where I would like to point different domain names as well as virtual directories. Right now, I create for each domain name a...
2
by: Gianguz | last post by:
I'd like to discuss about the opportunity to have a global objects creator that introduces into a general framework (suited for multithreading) a controlled semantic to manage globals variables...
33
by: MLH | last post by:
I've read some posts indicating that having tons of GV's in an Access app is a bad idea. Personally, I love GVs and I use them (possibly abuse them) all the time for everything imaginable - have...
11
by: Capstar | last post by:
Hi, I am working on an application, which will run embedded without an OS. The app is build up out of a couple of well defined parts. At first I wanted to keep those parts seperated and use...
8
by: Thomas Coleman | last post by:
Ok, I've obviously discovered that Global.aspx has been completely changed in ..NET 2.0. However, I haven't figured out how to declare a constant that's available to any page in my application...
10
by: m.epper | last post by:
Hi to everybody. First of all sorry for my english, I'm italian. How can I execute a portion of code, in a function, into the global scope? Example: <?php
44
by: fabio | last post by:
Why? i' ve heard about this, the usage of global vars instead of locals is discouraged, but why? thx :)
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
1
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
14
by: ramprat | last post by:
Hi All, I currently need to store 3 variables to be used as global variables throughout my application. I need to record the username, their employee group and the task they are doing. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.