Replace text in multiple files

Hello,

I thought this would work, but it doesn't have any affect on the file. Do I perhaps need to read the file to clipboard or variable, then write the file back? The regex works on a variable. I want

cusessions: '1'

to become

cusessions: 1

with the number being able to change.

Thanks.

Replace text in multiple files.kmmacros (2.2 KB)

Yeah that's the idea.

Have a go with this. It doesn't use regex, as it seems you're just trying to replace one simple text string with another. Pay attention to the file type being written (end of the macro) and change it if need be:

Search and Replace in Selected Files.kmmacros (22 KB)

Macro screenshot

2 Likes

Thanks. That does it. The regex is so that the number can be different values but I only need to run the macro once as such. Hope that makes sense.

1 Like