Most voted "replace" questions
Replace is the action of searching for a sub-string in a string and replacing it with a different sub-string. Use this tag for questions about replacing some value with another.
Learn more…94 questions
Sort by count of
-
1
votes1
answer849
viewsHow to "clean" a csv file with Python?
Hello! I’m extremely new to programming, so I apologize if I can’t explain what I’m trying to do or if my code is really wrong. I have a recurring task in my job which is to open a list of…
-
1
votes1
answer402
viewsIllegal group Reference error
You’re making a mistake on a replace what I’m doing. The string in question is this: <table id='tablecritica' class='table table-bordered table-hover'> <tbody> <tr> <td>…
-
1
votes2
answers286
viewsRemove characters that are before another
My teacher asked to make a method that cancels a character in a sentence using the # cancels the previous character, example: Entree: PUO#C MIP#NO#AS Exit: PUC MINAS However, my code gives error…
-
1
votes1
answer265
viewsRemove "Nan" from a data.frame in R
I have a data.frame with two columns that have some NaN and Inf and I’d like to replace them with NA. I was using this code, but it didn’t work: library(tidyverse) dados <-…
-
1
votes1
answer341
viewsHow to remove space from the JSON (String) value in C#?
I have the following JSON stored in a String variable: {"novosPedidos":[],"pedidos":[{"Apagar":" 633.56"}]} The "Delete" value contains a space which I need to remove. I tried using the Replace()…
-
0
votes1
answer1064
viewsHow to create date file in iso string in name?
I’m having trouble creating a file with the following template: 2017-01-17T09:42:15.3419026-02:00_teste.txt When I run the application to create appears this message: No support for the given path…
-
0
votes3
answers192
viewsSwap String content for "$"
I have a string with a content and I need to make a replaceAll, but the text to be replaced contains a "$" dollar sign and this causes the error Illegal group reference. Example: String texto="teste…
-
0
votes1
answer224
viewsPHP: Replace only on the first word repeated
Hello, for example, I have the phrase: My name is "Victor", the name "his" "is" "Victor", "his" name "is" "Victor" I use a preg_replace to exchange all the words in quotation marks with the word…
-
0
votes1
answer197
viewsREPLACE in the IN - Mysql clause
I have the following query below, and the idea is to take the value of the @subcategories variable and put in the query’s IN: set @subcategorias = replace('10, 11, 29, 30, 31', '''', ''); SELECT…
-
0
votes2
answers724
viewsRegular expression to deny anything other than social reason
I’m trying to create a regular expression to remove everything that is not part of the social reason in a string, but I’m having a hard time not removing the symbols that are in the middle of it.…
-
0
votes1
answer582
viewsASP Classico: How to replace the character "DASH" with "DASH"?
I have a problem - when using a PDF component - I ended up having a "Out of Range" error when generating the PDF document. by error and line I found out where the problem was - and identified that…
-
0
votes0
answers161
viewsInclude a point and comma to a variable
Hello, I have a small problem, I have a number coming from a sum and I need to assign a mask to that number. I did some tests until it worked however the mask was not correct to the number. var…
-
0
votes0
answers55
viewsError in String.replace Java
I’m having a hard time getting the String.replace("á","a") In my case I type Canadá and I want out houseboat, but in the output appears instead of a square, as if there were an invalid character.…
-
0
votes1
answer81
viewsFind string character position and remove it
I have a complicated problem to solve, there are 3 types of variables that receive data via post example: $mes = "08"; $mes = "10"; $mes = "12"; In the case of 3 different types of string, I need 0…
-
0
votes1
answer246
viewsReplace by ignoring tag and returning as string
I think I’ve seen this problem here once, but I couldn’t find it at all, even searching the Internet (I forgot what words to use in the search because I think I’ve dealt with it before but gave me a…
-
0
votes0
answers152
viewsCharacter replacement in Sql Server tables
I need to replace some strings in a database. I’M TRYING WITH: UPDATE dbo.ModeloMensagem SET corpoMensagem = REPLACE(dbo.ModeloMensagem.corpoMensagem, '<', '[') WHERE…
-
0
votes1
answer2282
viewsDoubt in Cifra de César Javascript
Hello, I’m new to Javascript and had a problem with this code: <!DOCTYPE html> <html> <head> <title>Caesar Cipher</title> <meta charset="UTF-8"> <style>…
-
0
votes1
answer43
viewsReplace Line in string
I’m creating a C# application using Replace(), i can replace a specific word by another in the entire file, but I wonder if there is a way to do this replace in just one specific line. I want the…
-
0
votes1
answer30
viewsPython - Replace x lines above and below the searched text
Good, I needed to do something that in a document filled in for example as: linha1 bla bla linha2 bla bla linha3 bla bla linha4 bla bla linha5 bla bla linha6 bla blax linha7 bla bla linha8 bla bla…
-
0
votes2
answers115
viewsReplace with variable - mysql
How can I do Replace using a variable? A certain variável receives values from a query, so I need to make a Replace in a given column, with the obtained values ,how can I do this? follows example in…
-
0
votes1
answer183
viewsHow to take the value of $_GET['sealed'] to leave the checkbox selected using PHP
I have an array in PHP that are the values selected from the checkbox, which were obtained by $_GET: $_GET['selecionados'] = array(2) { [0]=> string(1) "a" [1]=> string(1) "b" } There I have…
-
0
votes1
answer516
viewsReplace SQL SERVER between columns
How to replace between columns in SQL SERVER. For example, given the table below: COLUNA_A | COLUNA B | COLUNA_C A 123 casa I tried to run the query: SELECT REPLACE(COLUNA_C, COLUNA_A, COLUNA_B )…
-
0
votes1
answer55
viewsProblem with jquery percentage calculation
Good afternoon , I’m having trouble calculating percentage, but the error does not occur in the mile up, anyone has any idea what may be? var cost_value = $('#cost_value').val().replace('.',…
-
0
votes1
answer978
views -
0
votes1
answer88
viewsreplaceAll How to do repetition
want to make a replaceAll from 0.0 to 9999.9999 and wanted to know if there’s another way besides adding 1 by 1? I was doing like this fim = fim.replaceAll("0.0", "0.0f"); fim =…
-
0
votes2
answers48
viewsString sub-stituir per variable
i have the following text inside a.txt file [ExpertSingle] { 1050 = N X 0 1260 = N X 0 1470 = N X 0 1680 = N X 0 1890 = N X 0 2100 = N X 0 I want to turn "X" into numbers using Choice Ring to look…
-
0
votes2
answers63
viewsEdit date value within a dataframe
I have this Dataframe and the date is in the following format: '2020-08-01' I would like to write a loop that iterates on each line and performs the switch to the following format: '01/08' I’m using…
-
0
votes2
answers329
viewsJavascript: remove accents and spaces
Good afternoon! Can someone help me solve the problem of how to remove accent and spaces. When selecting state Alagoas and city Barra de São Miguel, returns thus Barra de São Miguel.html and that…
-
0
votes1
answer90
viewsReplacing and concatenating the contents of a cell
First I filter the contents of a table column to get everything that does not contain /. ActiveSheet.Range("A1").AutoFilter Field:=3, Criteria1:="<>*/*" With this result, I would like to…
-
0
votes1
answer386
viewsOpen text file in float value list
I need to open some files I have here that are in txt format which is even less common and specific in data processing issues, these files consist of values from 0,000 up to 0,999 and also from…
-
0
votes2
answers150
viewsRegex to remove the comma with a previous space
I have this string. Code: mrkk-918278 ,Title: Blouse-02 ,Price: R$ 60,50 ,Qty: 1 ,Code: mrkk-918277 ,Title: Blouse long sleeve ,Price: R$ 50,50 ,Qty: 1 ,Code: mrkk-918279 ,Title: Blouse-03 ,Price:…
-
0
votes1
answer42
viewsWhat is the problem with using the string replace method in my typescript code?
Good afternoon, you guys. I am using the Typescript language for the first time in a "weekend project" in developing an extension for Vscode. I’ve done research for the method documentation, but I…
-
0
votes2
answers50
viewsUPDATE REPLACE works on Phpmyadmin but does not work on Workbench
I can use this code on HphpmyAdmin: UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`, 'src="https://www.meusite.com.br/wp-content/uploads/2014/07/tipo.gif" alt="Baixar" width="24"…
-
-1
votes2
answers1168
viewsAppear two decimal places
In this code I have, when value reaches 200.00... it shows 200, when it has decimal places, it shows decimal places... 200.55 = 200.55 However, I need him to show both decimals even if it’s "10.00",…
-
-1
votes1
answer280
viewsstr.replace with javascript only works once!
Good morning to all!! I wonder what I’m doing wrong in the code: function () { var x = infoComentarioStrReplace.replace(" $$ ","*")//var resposta = infoComentarioStrReplace.replace("$", "#");…
-
-1
votes1
answer57
viewsHow to replace digits with "!" in SQL (postgresql)
Good Afternoon, I am trying in an output to exchange all digits in the address column for a '!'. I tried the following solution among others, but for some reason I’m not getting what I want. select…
-
-1
votes1
answer24
viewsRemoving non-numerical value from a dataframe
My intention is to remove the values that appear with '...' as shown above and replace with an empty field. The code I’m using to try to remove is this: df['Energy Supply'].str.replace('[.]*', '')…
-
-1
votes1
answer327
viewsChanging characters from a python message
I want to make a program that encrypts a message by the polar Zenit method, which consists of exchanging these letters among themselves, changing the text without the use of accents. I can already…
-
-1
votes1
answer291
viewsHow to replace two or more hyphens or spaces with just one hyphen
I’m building a blog and I need a script to get the title of the post and generate a link (without accents and spaces), as you write. I rode this one below, but I could not ignore 2 hyphens in a row,…
-
-1
votes1
answer162
viewsRepeat the value of a line in the rows immediately below a dataframe in R
I need to write a function so that the values highlighted in yellow are repeated in the cells below, including overwriting those cells that already have values. Otherwise, the values to the left of…
-
-1
votes2
answers105
viewsHow can I turn a string into a float?
I am doing a job and I came across the following situation: I have a list with decimal numbers. But the list is like a string. For example: h = ["3,5","4,3","8,9"] Now my problem appears, I need the…
-
-1
votes1
answer64
viewsRemove words after specific python character
Hello. I need to find a way to standardize the following classes in python db.groupby(["EdLevel"])["EdLevel"].count() Master's degree 11141 Master's degree (M.A., M.S., M.Eng., MBA, etc.) 13112…
-
-1
votes0
answers14
viewsIs it possible through an Migration to use a replace to change a data record of an already populated table?
In the database there are already some data entered, and I need through an Migration to make a change to take the value that is there and change the "." by "/". Ex: there in ID 1, has the value…
-
-2
votes3
answers425
viewsReplace Space by Comma
$var = 123 456 789; I need the value of this variable to stay: $var = 123,456,789; Or add a comma after the number: $var = 123, 456, 789; I tried so: str_replace($var," ","")…