cancel
Showing results for 
Search instead for 
Did you mean: 

Replace a full word that starts with certain characters

JensDeveloper
Contributor II

Hi, I am trying to replace the words that starts with ‘Auft’ because somehow it changes the next two characters by ��
Image Below:
image

I’m not a professional in regex expressions so I am trying to learn it but I can’t come up with the solution. I always taught you could do $title.replaceAll(‘Auft’.*, ‘Auftragge’)

1 REPLY 1

koryknick
Employee
Employee

replaceAll() is expecting a string literal, so it is looking for a period and asterisk to follow Auft.

I think what you want is the replace() method using an expression. This would be something like the following:

$title.replace(/Auft.*/g, 'Auftragge')