Category "replace"

How to search and replace text in an XML file using Python?

How do I search an entire xml file for a specific text pattern and then replace each occurrence of that text with new text pattern in Python 3.5? Everything

search and replace with regex to increment numbers in Visual Studio Code

I'm currently working on a big svg sprite. The diffrent images are always 2000px apart. What I have is: <g transform="translate(0,0)"> <g transform="

regex remove line breaks between double quotes without affecting other line break (eager match)

I have a map (key, value pairs) and few of these values have line breaks within them (inside double quotes) which is causing issues in CSS. How can I remove the

Strict regex in Pandas replace

I need to write a strict regular expression to replace certain values in my pandas dataframe. This is an issue that was raised after solving the question that I

Why are some characters ignored when calling LastIndexOf?

Please take a look at these codes : string str_to_find = "➖➖➖➖➖➖➖➖➖➖\r\n"; string str

How to replace pandas dataframe column names with another list or dictionary matching

I need to replace column names of a pandas DataFrame having names like 'real_tag' and rename them like 'Descripcion' list = [{'real_tag': 'FA0:4AIS0007', 'Descr

How to Replace text in the output from a Batch Script

I have a script I run and this is a sample output: OK J: \\har-fs01\dept OK K: \\erl-tbafs01.tbamerica.com\share OK

finding and replacing elements in a multidimensional list (python)

Similar to this question: finding and replacing elements in a list (python) but with a multi-dimensional array. For example, I want to replace all the N's with

Efficient way to edit the last line of a text file in Python

I have a Python script which creates a large SQL insert file of about 300,000 lines. The problem with this is that the last line of the file ends up looking lik

Replace a name in a string in Python

I'm working on a assignment and I need to replace Alice with my name. Here is the program, for i in range(10): print(i) print(split_alice[i]).replace_a

VS Code Extension API - Replace a String in the document?

const textEditor = vscode.window.activeTextEditor; if (!textEditor) { return; // No open text editor } for(var i=

How do i replace [] brackets using SED

I have a string that i am want to remove punctuation from. I started with sed 's/[[:punct:]]/ /g' But i had problems on HP-UX not liking that all the time

IntelliJ replace variable names in multiple lines

I am wondering is there a shortcut that can replace a variable name with a new name on multiple lines in the current Java file for IntelliJ. Is it just simply d

How to replace first occurrence of string in Java

I want to replace first occurrence of String in the following. String test = "see Comments, this is for some test, help us" **If test contains the input as

Regex to replace all password with ***

I have the following json: Data: {"Account":"d\\adm","Password":"cWExZjEiMTM="},"SqlServer":{"InstanceName":"","MachineName":"MyMachine","Port":null} I would

regular expression to copy line with some changes, mirror

I have a code in each html page that I want to duplicate, while add some changes: Example: <title>Any text (even if includes :.,</title> Output: