tagged [replace]

Replace special characters in a string in Python

Replace special characters in a string in Python I am using urllib to get a string of html from a website and need to put each word in the html document into a list. Here is the code I have so far. I ...

29 Mar at 22:3

Replace all elements of Python NumPy Array that are greater than some value

Replace all elements of Python NumPy Array that are greater than some value I have a 2D NumPy array and would like to replace all values in it greater than or equal to a threshold T with 255.0. To my ...

Want to remove the double quotes from the strings

Want to remove the double quotes from the strings I saw some questions here related to removing double quotes. But it not solved my Issue. They told to use Replace or Trim functions. I used but the pr...

5 Oct at 06:11

Transform title into dashed URL-friendly string

Transform title into dashed URL-friendly string I would like to write a C# method that would transform any title into a URL friendly string, similar to what Stack Overflow does: - - - I'm thinking of ...

9 Jun at 17:58

Replacing accented characters php

Replacing accented characters php I am trying to replace accented characters with the normal replacements. Below is what I am currently doing. ``` $string = "Éric Cantona"; $strict = strtolower($str...

PowerShell Script to Find and Replace for all Files with a Specific Extension

PowerShell Script to Find and Replace for all Files with a Specific Extension I have several configuration files nested like such: In my configuration I need to do a string replace like such: will bec...

26 Jan at 17:53

How can non-ASCII characters be removed from a string?

How can non-ASCII characters be removed from a string? I have strings `"A função"`, `"Ãugent"` in which I need to replace characters like `ç`, `ã`, and `Ã` with empty strings. How can I remove those n...

28 Nov at 05:46

Replace given value in vector

Replace given value in vector I'm looking for a function which will replace all occurrences of one value with another value. For example I'd like to replace all zeros with ones. I don't want to have t...

31 Jul at 09:44

JS. How to replace html element with another element/text, represented in string?

JS. How to replace html element with another element/text, represented in string? I have a problem with replacing html elements. For example, here is a table: (it can be div, span, anything) And strin...

7 Jun at 19:18

Replacing an element and returning the new one in jQuery

Replacing an element and returning the new one in jQuery How do you replace an element in jQuery and have the replacement element returned instead of the element that was removed? I have the following...

21 May at 13:19

How to replace a character from a String in SQL?

How to replace a character from a String in SQL? I have 100's of cells in our database which contain `?` instead of `'`. It is possible that this might happen in all rows and columns and in more than ...

3 Aug at 20:31

Replace "\\" with "\" in a string in C#

Replace "\\" with "\" in a string in C# I still don't get how to do this. I saw many posts regarding this, but none of the solutions worked for me. I have a string called "a\\b". The result I need is ...

14 Jul at 21:36

Replace only some groups with Regex

Replace only some groups with Regex Let's suppose I have the following regex: and I want to replace, using C#, the Group 1 `(\d+)` with `AA`, to obtain: Now I'm replacing it using: But I don't really ...

23 Jan at 08:1

Is it more or less efficient to perform a check before performing a Replace in C#?

Is it more or less efficient to perform a check before performing a Replace in C#? This is an almost academic question but I'm curious as to its answer. Suppose you have a loop that performs a routine...

10 Sep at 06:43

How to input a regex in string.replace?

How to input a regex in string.replace? I need some help on declaring a regex. My inputs are like the following: The required output is: ``` this is a paragraph with in between and then there ar

9 Aug at 12:4

How can I use mySQL replace() to replace strings in multiple records?

How can I use mySQL replace() to replace strings in multiple records? We have a database that has a bunch of records with some bad data in one column, in which an embedded editor escaped some stuff th...

7 Oct at 11:6

Python Replace \\ with \

Python Replace \\ with \ So I can't seem to figure this out... I have a string say, `"a\\nb"` and I want this to become `"a\nb"`. I've tried all the following and none seem to work; ``` >>> a 'a\\nb' ...

3 Mar at 21:52

str_replace with array

str_replace with array I'm having some troubles with the PHP function `str_replace` when using arrays. I have this message: And I am trying to use `str_replace` like this: ``` $new_message = str_repla...

5 Dec at 03:29

How does MatchEvaluator in Regex.Replace work?

How does MatchEvaluator in Regex.Replace work? This is the input string `23x * y34x2`. I want to insert `" * "` (star surrounded by whitespaces) after every number followed by letter, and after every ...

21 Jan at 10:0

C# - Replace a character with nothing

C# - Replace a character with nothing I have a `RichTextBox` that looks like this: and I want to replace the with nothing and place it into a `ListBox`...

26 Jul at 20:27

Fastest way to replace multiple strings in a huge string

Fastest way to replace multiple strings in a huge string I'm looking for the fastest way to replace multiple (~500) substrings of a big (~1mb) string. Whatever I have tried it seems that String.Replac...

21 Apr at 06:15

Find and replace words/lines in a file

Find and replace words/lines in a file I have a file (more specifically, a log4j configuration file) and I want to be able to read in the file and pick out certain lines in the code and replace them. ...

16 Jun at 02:3

Find and replace in Visual Studio code in a selection

Find and replace in Visual Studio code in a selection I have the following line in a file I'm editing in VSCode: `...............111.........111.............111..` I want to replace all `.`s with `0`s...

2 Mar at 20:44

Replacing multiple characters in a string, the fastest way?

Replacing multiple characters in a string, the fastest way? I am importing some number of records with multiple `string` fields from an old db to a new db. It seems to be very slow and I suspect it's ...

23 May at 12:1

Replace any string between quotes

Replace any string between quotes Cannot find a consistent way to replace a random string between quotes with a specific string I want. Any help would be greatly appreciated. should become but also wo...

23 May at 12:24