Replacing is the action of searching a string for a sub-string and replacing it with a different string.

learn more… | top users | synonyms (4)

3
votes
4answers
4k views

Reading and Writing Configuration Files

I'm writing a small script which generates some configuration for devices. I want to have separate file, where I'm storing configuration, and change some strings during printing the content of the ...
47
votes
4answers
38k views

Javascript multiple replace

How do you replace all instances of one string with another in javascript? Example: someString = 'the cat looks like a cat' anotherString = someString.replace('cat', 'dog'); results in ...
11
votes
9answers
32k views

how to replace special characters with the ones they're based on in PHP?

How do I replace: "ã" with "a" "é" with "e" in PHP? Is this possible? I've read somewhere I could do some math with the ascii value of the base character and the ascii value of the accent, but I ...
56
votes
8answers
70k views

Fastest method to replace all instances of a character in a string

What is the fastest way to replace all instances of a string/character in a string in Javascript? A while, a for-loop, a regular expression?
40
votes
14answers
18k views

How do I replace the *first instance* of a string in .NET?

I want to replace the first occurrence in a given string. How can I accomplish this in .NET?
121
votes
7answers
134k views

How to replace all points in a string in JavaScript

I want to replace all the occurances of a period (.) in a JavaScript string For example, I have: var mystring = 'okay.this.is.a.string'; I want to get: okay this is a string. So far I tried: ...
16
votes
6answers
14k views

Case insensitive string replacement in JavaScript?

I need to highlight, case insensitively, given keywords in a JavaScript string. For example: highlight("foobar Foo bar FOO", "foo") should return "<b>foo</b>bar <b>Foo</b> ...
18
votes
2answers
16k views

Android: can't replace one fragment with another

I need to replace a fragment in one activity with another fragment, below is the layer file of the activity: <?xml version="1.0" encoding="utf-8"?> <FrameLayout ...
12
votes
2answers
13k views

MySQL Regex Replace

Does anybody know how I could have, in a MySQL query, the same behaviour as the Regex.Replace function (for instance in .NET/C#)? I need that because, as many people, I would like to count the number ...
93
votes
9answers
31k views

Is there an alternative to string.Replace that is case-insensitive?

I need to search a string and replace all occurances of %FirstName% and %PolicyAmount% with a value pulled from a database. The problem is the capitalization of FirstName varies. That prevents me from ...
12
votes
5answers
8k views

How to change diacritic characters to non-diacritic ones

I've found a answer how to remove diacritic characters on stackoverflow, but could you please tell me if it is possible to change diacritic characters to non-diacritic ones? Oh.. and I think about ...
10
votes
6answers
20k views

XSLT Replace function not found

I am writing an XSLT transformation in which I wish to use the Replace function to do a regex match and replace. However, Visual Studio 2008 reports that 'replace()' is an unknown XSLT ...
23
votes
4answers
22k views

C++ Replace part of a string with another string

Is it possible in C++ to replace part of a string with another string. Basically, I would like to do this QString string("hello $name"); string.replace("$name", "Somename"); but I would like to use ...
4
votes
2answers
9k views

PHP - Replace colour within image

I hope someone can help, I have made a script that masks images... however it is reliant on a colour to mask with ( 'green screen' style). The trouble is if the image that I am masking contains that ...
0
votes
1answer
602 views

highlight words in html using regex & javascript - almost there

I am writing a jquery plugin that will do a browser-style find-on-page search. I need to improve the search, but don't want to get into parsing the html quite yet. At the moment my approach is to ...

1 2 3 4 5 39
15 30 50 per page