All Questions
Tagged with str-replace or replace
31,030 questions
0
votes
2
answers
123
views
Replace values in multiple columns in a data frame based on conditions in another data frame? [duplicate]
I'm working with a data frame where the color of an object (red or green) was recorded in ordinal classes corresponding to percent coverage.
I am looking to replace all the classes with their ...
-2
votes
1
answer
117
views
Arabic Word Normalization and Search Ignoring Prefixes and Suffixes in quran app [closed]
I’m developing a Qur’an search application that allows users to search for Arabic words and find their occurrences across the Qur’an.
To improve accuracy, I added a feature that removes Arabic ...
0
votes
2
answers
105
views
Search / replace in R with a capture group
In a Quarto book, I mention R functions as back-quoted strings in text like this, always ending in ()
test <- "The functions `lm()` and `car::vif()` are good test cases"
I would like to ...
0
votes
3
answers
167
views
:args and ripgrep in neovim
Question
I am trying to find a string across multiple files using ripgrep where the string has lots of characters that would need to be manually escaped if I were to subsequently replace the string ...
0
votes
0
answers
40
views
nvim : map multiple-words
I want to define a map for a several-words expression.
In ~/.config/nvim/init.vim :
:map abc a-b-c
works perfectly well.
But I want to do something like
:map a\ b\ c a-b-c
If I type "a b c"...
0
votes
2
answers
290
views
How do I optimize my C# method to replace exact matching data in a string?
The current implementation takes on average 10-15ms to run each time it is called (timed using the Stopwatch class before / after the call. It will be called on average 100 times per minute.
The input ...
0
votes
0
answers
19
views
Remove paired brackets and content within it
I need to process some data in python dataframe. The column "description" includes some special cases need to be removed.
In following example string: "LEATHER SEATS (REQ: include (Full ...
2
votes
1
answer
58
views
Odd behavior using -replace with Underscore Character
I've noticed a bit of odd behavior with the -replace command in PowerShell, and I'm just wondering if anyone out there can tell me what's going on.
I was writing some code to make sure that a new ...
2
votes
3
answers
197
views
Ansible lineinfile and replace modules, attempting to configure toml txt file
I have been trying to update configuration settings in a pi-hole.toml file.
After attempting lineinfile, it landed me on the replace module as the more appropriate to use. But I haven't had any luck ...
0
votes
1
answer
71
views
Run maven plugin for root directory in multi-module java project
I have a maven based multi-module Java project. The root directory consists of various sub-modules as well as other directories which holds scripts, configurations and documentations files.
There are ...
2
votes
1
answer
175
views
How to replace *all* occurrences of a string in Python, and why `str.replace` misses consecutive overlapping matches?
I want to replace all patterns 0 in a string by 00 in Python. For example, turning:
'28 5A 31 34 0 0 0 F0'
into
'28 5A 31 34 00 00 00 F0'.
I tried with str.replace(), but for some reason it misses ...
1
vote
0
answers
71
views
Powershell script to upgrade keywords in Font Awesome from 5 to 6
With the change from Font Awesome 5 to 6 in my Angular project many of the keywords for the icons changed. I need a Powershell script to replace tham all inside the .html files.
A list with all ...
0
votes
0
answers
31
views
Using String.Replace() in C#
I'm doing some maintenance on a C# WinForms app and noticed that code similar to that below appears in several places:
foreach (DataRow rowSubs in subsList)
{
internalSubName = rowSubs[...
0
votes
0
answers
37
views
How do I then replace the changed tags from the selection in the main document?
I am new to AngleSharp. I am processing text in the desired tags in html documents. I select tags-elements with text, then change the text in each tag in the selection. How then to replace the changed ...
-4
votes
1
answer
67
views
How to create json content object where some of the content will be prefixed and suffixed with backslash and doublequote \"
I have following python code:
import json
data = {"name": "John", "age": 30, "city": "New York"}
print(data)
json_string = json.dumps(data, indent=4)
...
0
votes
0
answers
96
views
Lua table index changes its values without assigning any to them
Lua table (ref) index changes its values without assigning any to them.
Why does ref table change its values after assigning it to tab[c] or using string.match()? The actual behavior is that the ref ...
3
votes
2
answers
100
views
Efficient way to remove unwanted characters from a string in Kotlin
I'm working on a kotlin project that needs to process some phone number data and convert it into a format suitable for a third party API to consume. The requirements are:
No non-digit characters ...
2
votes
5
answers
197
views
Replace all instances of character in portion of string in bash
I need to replace all instances of a character (period in my case) in 1+ portions/segments/ranges of a string. I'm using Bash on Linux. Ideally the solution is in Bash, but if it's either not ...
-3
votes
1
answer
139
views
Unable to write a regular expression, no AI I've tried works [closed]
I need a PCRE Regular Expression that will find and select a specified phrase at the beginning of sentences, only if it is preceded by a sentence that also contains the phrase. The first sentence ...
5
votes
1
answer
141
views
Count actual replacements
Overview
I've created a basic text editor with a "Replace all" feature. However, I'm facing an issue where the output indicates replacements were made even when the text remains unchanged. ...
1
vote
1
answer
70
views
Insert replace text based on a name in other file python script
I have two text files, File 1 is a list of names of meshes with a path sometimes the name is the same as the path name and can contain numbers.
I need is to insert File 1 filename/path onto every ...
0
votes
2
answers
57
views
How to create new dataframe that copies all data from another where the new one converted all values beginning with -9 to NaN?
I have a dataframe of 10899 rows × 32 columns where there are many cells containing data that start with -9. e.g. -99.0, -9, -9.678, etc.
How can I create a new dataframe from the original where all ...
6
votes
6
answers
225
views
Replace the last non NA entry of a row with the value from another column
I have a dataset like this:
tdf <- data.frame(
A = c(1, 2, 5, 4),
B = c(NA, 3, 4, 5),
C = c(NA, NA, NA, NA),
D = c(NA, NA, NA, NA),
E = c(10, 20, 30, 40))
And I need to ...
2
votes
1
answer
120
views
replace range of projected struct fields
I have a range over a multi field structure.
The fields can only be accessed via operator [].
I want to run a replace over one of these fields.
I can do this using a range based for loop.
Is there a ...
0
votes
2
answers
61
views
Why does the entire secret string get replaced with the guess? [duplicate]
I'm making a hangman game.
Here's part of the code where a string progress is (potentially) modified with the user input string guess.
if (secret.contains(guess)) {
System.out.println(guess + &...