Questions tagged [replace]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
1 answer

Using String.replaceAll() to remove character combination

I need to remove all redundant hyphens in a given string, e.g.: "Bla----Bla---Bla--Bla" to "Bla-Bla-Bla-Bla", using as little code as possible. At the moment I've implemented this: ...
jdrees's user avatar
  • 207
1 vote
2 answers

Replace character in string in specific position (ie not first, not all)

I would like to replace one character in a string with an uppercase of the same character. Is there an elegant way to do this? Eg I have 'Donald Mcdonald' and I would like to uppercase the first 'd' ...
Irene's user avatar
  • 1,829
1 vote
1 answer

Using replace() to remove a value from an array in LWC with a RegExp

I just want to remove a value from an Array in LWC using the method replace with RegExp. @track myList = ['a', 'b', 'c']; @track removeValue = 'b'; if (this.myList.includes(this.removeValue)) { ...
Carlos Naranjo's user avatar
0 votes
1 answer

Regex to find dd/mm/yyyy

I have a pretty simple code and in one case it works, and not in all the case, I wanted to know what I'm missing I'm trying to match a date in this format dd/mm/yyyy This is my code: String d = '20/03/...
Yaac0's user avatar
  • 165
0 votes
1 answer

Replacing text in lightning email template from apex

I have an Email template which looks like that : ----------------------- Name : {ContactName} Account : {AccountName} {price} : {Cost} Date: {MinDate} ------------- I'm using the email template to ...
Salvation's user avatar
  • 1,189
0 votes
1 answer

Replace function - SQL - Data Extension

I have a data extension with a column titled 'Email Name'. My reporting I have it pipe (|) delimited into a .txt file. When the 'Email Name' column comes in, some values have spaces in the front for ...
chorlesbarkley7's user avatar
0 votes
1 answer

ReplaceAll does not function Apex

Hello everybody I am managing data from a LWC form where the user inputs some data and I pass it to validate into an apex class. This validation manages the format of a date time value: I want the ...
user avatar
0 votes
2 answers

Remove spaces and accents from a value field to put it in a From Email Adress field - dynamic sender profile

I need to remove spaces and accents (special characters) and capital letters from the 'From Email Address' field in the sender profile. Indeed, I would like to compose a dynamic From Email Address in ...
Lamia Hafid's user avatar
0 votes
2 answers

Removing leading zeroes in Date String

I have checked a number of posts and regex examples but for some reason I can't get the leading 0's to be removed from the date string below. Can anyone see what I am doing wrong? wanted result: 4/6/...
Olivia's user avatar
  • 3,461
0 votes
1 answer

I need to replace white space to either side of a word

I am pulling a string of text from a DE. One of the text strings contains the hyphenated word t-shirt, which ends up being split over two lines. I want to search the text string for a hyphen, then ...
mr_reamer's user avatar
0 votes
3 answers

How to update null records in JSON

I'm currently working on the below JSON. Sometimes records in matches return null, instead of record. And null will appear anywhere within the array { "status": "success", ...
Pavan tej's user avatar
  • 1,460
0 votes
1 answer

Apex replace \" in string

String jsonString = 'Error \"fatal\"'; String jsonString2 = jsonString.replaceAll('\\"', ''); System.assertEquals(jsonString, 'Error fatal', 'Assertion failed'); The jsonString ...
dev4life's user avatar
  • 510
0 votes
1 answer

Modify string value in soql list and add back to list

I have a VFP which functions as a CSV download. In my controller I return a simple SOQL list from a custom Customer object. I need to modify the Name being returned to remove all commas and then add ...
Wes's user avatar
  • 41
0 votes
1 answer

Replace double quotes in dataview Bounce

I'm trying to replace double quotes in "SMTPMessage" field of Bounce dataview in Marketing Cloud. But I've entered in several ways, but the quotes do not disappear. What I did so far is this ...
Daniel Tazinaffo's user avatar
0 votes
1 answer

Replace escaped quotes

I want to replace all escaped quotes, but leave default quotes. How can i do it? string s1 = '"five1,five2", six ,seven,"eig\"ht1,eight2","nine",,eleven'; String ...
murkofeste's user avatar
0 votes
1 answer

Replace Subject fields on Lightning Email Template

I'm having problems with replace() operations of text that I have in Subject of my Email Template. Subject is like: A - B - C My code is: EmailTemplate eTemplate = newEmail.searchForEmailTemplate('...
CPS's user avatar
  • 345
0 votes
0 answers

Unable to parse Json with special character inside Apex [duplicate]

I need to parse the below JSON in salesforce apex. In the message value, special character is not allowing to parse. Added image of JSON parser online. Javascript replace wont work in apex Ex: ...
Sharath Jallu's user avatar
0 votes
0 answers

Error escaping double quotes in large JSON string in Apex

I have large JSON response that I am trying to escape all instances of strings that are problematic for deserialization but am having some issues. Using .replaceAll works but that throws a "Regex too ...
626's user avatar
  • 273
-1 votes
1 answer

Replace String inside json inside Array Javascript

Hello guys I have a js file that has a list of json that have the next structure: [{"label":"9312 - Item1", "value":"9312"}, {"label":"9313 -...
TechGuy's user avatar
  • 97