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 / Best way to prevent fo...
Power Automate
Answered

Best way to prevent forbidden characters

(1) ShareShare
ReportReport
Posted on by 260

Hello

 

I have been trouble shooting occasional errors in my flow. The user enters text in a SharePoint field and a folder is generated after that. 

It had been giving me BadRequests, but a trim operation removed any trailing spaces and it worked great, until it the issue started again.

As it turns out there are also forbidden characters, (:, /, ...) being used.

 

I naturally think a replace operation could screen out the characters, but it would be a mess. Is there a more elegant solution?

 

Regards

Conn

Categories:
I have the same question (0)
  • Verified answer
    trice602 Profile Picture
    16,135 Super User 2026 Season 1 on at

    Hi @ConnM ,

     

    One thing that I have done is insert a compose and replace the illegal characters with an "_" or remove it completely.  Here's a sample replace expression to remove the most common characters:

    replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(test, '\\', ''), '/', ''), ':', ''), '*', ''), '?', ''), '"', ''), '<', ''), '>', ''), '|', ''), '&', ''), '#', '')

     

     

  • trice602 Profile Picture
    16,135 Super User 2026 Season 1 on at

    Note:  you would replace "test" above with your dynamic content.

     

     

  • ConnM Profile Picture
    260 on at

    Thanks @trice602 

     

    This is brilliant. I'll get this in ASAP

     

    Really appreciate it

    Conn

     

  • trice602 Profile Picture
    16,135 Super User 2026 Season 1 on at

    Hi @ConnM !  Nice!  Always glad to help and get this feedback on a Monday morning 🙂 

     

     

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 469

#3
11manish Profile Picture

11manish 364

Last 30 days Overall leaderboard