web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Replace expression doe...
Power Automate
Unanswered

Replace expression doesn't work for back slashes

(0) ShareShare
ReportReport
Posted on by 4

I have a flow that ingests a CSV via the default SFTP connector.  For some reason, this connector appends backslashes before double quotes, presumably so that they're escaped in the response body and not mistaken for JSON or another language.

 

Unfortunately, the replace() expression seems incapable of removing backslashes.  I've tried using the character, the ascii code for the character and using a variable to inject it.  None works.  I've also tried cleaning the CSV response and replacing the slashes later in the flow when the data is re-used.  I also tried using the replace expression to find anything with a backslash in it (eg. /"field/" is not matched, but 'field' is found).

 

I found this issue unsolved elsewhere
https://powerusers.microsoft.com/t5/General-Power-Automate/Remove-backslash-quot-quot-from-response/m-p/1440983#M85483

Categories:
I have the same question (0)
  • dep Profile Picture
    5 on at

    I had a file name in json format starting with "\\\\" that I had to replace with "\\". It worked for me to do the replace funtion like so: Replace(variable,'\\\\','\\')

     

    Hope it helps 🙂

  • Chriddle Profile Picture
    8,632 Super User 2026 Season 1 on at

    Yes, the backslash is the escape character of JSON.

    So when you access the string value, that character will be gone unless it escapes itself.

     

    An example:

    Chriddle_0-1713528352482.png

    Test1:

    outputs('Compose')['Test1']

    Test2:

    outputs('Compose')['Test2']

    Test2 wuith replace:

    replace(outputs('Compose')['Test2'], '\', '')

     

    You can see in the output that there is no backslash in Test1, and there are backslashes in Test2, which can be replaced in the usual way.

    Chriddle_1-1713528516789.png

     

  • Wendy_Lumsden Profile Picture
    58 on at

    Hi @wolskis ,

     

    I have a similar problem and wondered how you resolved this?

     

    I tried the option suggested by @dep but when I used the output from the array without a backslash before the double quotations in a concat expression, the concat added a backslash before the double quotations again 😞

    And using Replacing on the concat expression to remove the backslash did not work either.

    (the concat with strings which contain double quotations is being used in an xml query).

    Any assistance will be greatly appreciated.
    Thanks
    Wendy

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 250 Super User 2026 Season 1

#2
Expiscornovus Profile Picture

Expiscornovus 222 Most Valuable Professional

#3
Haque Profile Picture

Haque 174

Last 30 days Overall leaderboard