string-substitution Questions

2

Solved

I have a ID variable that comes from 35 different hospitals, so has varying different arrangements of the variable, and sometimes it has the same root ID number with a secondary line number - e.g. ...
Enigmatic asked 13/9, 2024 at 3:20

8

Solved

I would like to remove specific characters from strings within a vector, similar to the Find and Replace feature in Excel. Here are the data I start with: group <- data.frame(c("12357e", "125...
Mammillate asked 13/8, 2012 at 14:26

2

Solved

Precondition I have a string which looks like this: String myText= "This is a foo text containing ${firstParameter} and ${secondParameter}" And the code looks like this: Map<String, Ob...
Chesney asked 27/5, 2022 at 9:33

3

Solved

I am looking for regex (preferably in R) which can replace (any number of) specific characters say ; with say ;; but only when not present inside parenthesis () inside the text string. Note: 1. The...
Georgiegeorgina asked 8/6, 2021 at 11:52

1

Solved

I would expect gsub and stringr::str_replace_all to return the same result in the following, but only gsub returns the intended result. I am developing a lesson to demonstrate str_replace_all so I ...
Soapberry asked 19/6, 2020 at 13:17

1

Solved

I'd like to make a string substitution in a for block using a named capture. I've expected to get the numbers 1,2,3 as output. But it is Nil for the first run, and then 1 and 2 for the 2nd and 3rd ...
Deflate asked 22/1, 2020 at 19:47

1

Solved

I am trying to get some trade information from an exchange websocket. Both values .p and .q are enclosed between double quotes in the JSON I get from the socket. When I try to multiply two values,...
Telles asked 2/7, 2019 at 23:49

2

Solved

I've combed the docs but I can't seem to find how to do this in perl6. In perl5 I would have done (just an example): sub func { ... } $str =~ s/needle/func($1)/e; i.e. to replace 'needle' with...
Painful asked 10/5, 2019 at 12:9

1

Solved

One column of my data.frame looks like the following: c("BP_1_CSPP", "BP_2_GEGS", "BP_3_AEAG", "BP_4_KPAP", "BP_5_TAKP", "BP_6_GGDR", "BP_7_MQQP", "BP_8_EEEE", "BP_9_RSDP", "BP_10_APAS", "BP_11_...
Ugric asked 21/3, 2017 at 9:5

6

I have a document that I need to dynamically create/update the indexes in. I am trying to acomplish this with awk. I have a partial working example but now I'm stumped. The example document is as ...
Certitude asked 7/12, 2015 at 2:33

2

Solved

I'd like to create a new column of phone numbers with no dashes. I have data that is a mix of just numbers and some numbers with dashes. The data looks as follows: Phone 555-555-5555 1234567890 55...
Rowles asked 13/8, 2014 at 19:24

3

Solved

Does Bash have something like ||= ? I.e., is there a better way to do the following: if [ -z $PWD ]; then PWD=`pwd`; fi I'm asking because I get this error: $ echo ${`pwd`/$HOME/'~'} -bash: ${...
Bats asked 28/7, 2011 at 13:28

2

Solved

I have to replace one character with another in Excel file. I have used following Replace function, but due to exceeds of 1024 character limit in some cells, it stops there. Sub Replace() With ...
Knowing asked 10/7, 2013 at 1:57

2

Solved

In R, I have two character vectors, a and b. a <- c("abcdefg", "hijklmnop", "qrstuvwxyz") b <- c("abXdeXg", "hiXklXnoX", "Xrstuvwxyz") I want a function that counts the character mismatch...
Commutate asked 24/6, 2013 at 22:12

2

Solved

Yesterday, I got stuck in a perl script. Let me simplify it, suppose there is a string (say ABCDEABCDEABCDEPABCDEABCDEPABCDEABCD), first I've to break it at every position where "E" comes, and seco...
Ammeter asked 11/8, 2012 at 11:56

3

Solved

my_string = 'Here's the #: 49848! - but will dashes, commas & stars (*) show?' puts src.gsub(/\d|\W/, "") i.e. can I remove the or ("|"). Here's how I got here, can I get shorter? src = "...
Lubric asked 2/2, 2012 at 20:50

2

Solved

I have csv file contents having double quotes inside quoted text test,first,line,"you are a "kind" man",thanks again,second,li,"my "boss" is you",good I need to replace every double quote not pr...
Jepson asked 1/2, 2012 at 15:46

1

Solved

I have a string let's say http://someUrul.com/someController/SOmeAction?SomeQS=http://someOtherUrl and I want to replace the first http with https, but not the second, so I end up with https://som...
Sakmar asked 21/7, 2011 at 20:20

4

Solved

I want to do a substitution based on a wildcard. For example, change all "tenure" to "disposition" only if the word "tenure" comes after an '=' sign. Basically a regex that would match this =.*tenu...
Discontinuous asked 6/6, 2011 at 22:14

2

Solved

I have a struct in my Ruby code that looks somewhat like this Parameter = Struct.new(:name, :id, :default_value, :minimum, :maximum) later, I create an instance of this struct using freq = Para...
Santinasantini asked 17/11, 2010 at 15:46
1

© 2022 - 2025 — McMap. All rights reserved.