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

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Filter text for a code with unique digits

(1) ShareShare
ReportReport
Posted on by 2

Hey there everyone. I'm trying to create a flow that updates Planner when an Outlook calendar event is created with a unique code in the title. The code has always a specific letter as first digit and a dash as sixth digit and is 10 digit long. Example: 'Lxxxx-xxxx'. If it shows up anywhere in the event title then it should go to the planner. 

 

So far I'm stuck with the filtering. Tried some conditioning but I'm too much of a rookie to make a neat solution to that. Can anyone help me with this? Thanks in Advance!

I have the same question (0)
  • David_MA Profile Picture
    12,515 Super User 2025 Season 2 on at
    Re: Filter text for a code with unique digits

    If you can figure out how to extract your code from anywhere within the title, you can then use an expression such as this to make sure it is in the format and length you want:

    if(and(not(isInt(substring(triggerBody()['text'], 0, 1))), isInt(substring(triggerBody()['text'], 1, 4)), contains(substring(triggerBody()['text'], 5, 1),'-'), isInt(substring(triggerBody()['text'], 6, 4)), equals(length(triggerBody()['text']), 10)), 'true', 'false')

    The above just checks to make sure the first character is not a number, so it could be any valid character. Otherwise, it checks the format you listed.

     

    I have an expression somewhere to check if it is A-Z or a-z, but I cannot remember where 🙂

  • David_MA Profile Picture
    12,515 Super User 2025 Season 2 on at
    Re: Filter text for a code with unique digits

    I think I have something that will work for you. You can test it with a manually triggered flow.

     

    1. Add a string input to your flow named Title
    2. Initialize an Array variable named Split and set the default value to the following expression: split(triggerBody()['text'],' ')
      1. The above expression will break your title on each space
    3. Add an Apply to each and use the variable for the output
    4. Add a condition to check if the current item's length equals 10 with this expression:  length(items('Apply_to_each'))
    5. On the yes side of the condition, add a second condition to check if the following expression equals true: and(not(isInt(substring(items('Apply_to_each'), 0, 1))), isInt(substring(items('Apply_to_each'), 1, 4)), contains(substring(items('Apply_to_each'), 5, 1),'-'), isInt(substring(items('Apply_to_each'), 6, 4)), equals(length(items('Apply_to_each')), 10))
       
      1. Be sure to use true from the expression builder and do not type true.
    6. Then on the yes you can update your Planner item.
    7. If you want to be more efficient, you can wrap the apply to each in a Do until it finds your expression.

    The flow will look like this:

    David_MA_0-1720007630757.png

     

     
  • David_MA Profile Picture
    12,515 Super User 2025 Season 2 on at
    Re: Filter text for a code with unique digits

    That's a good option, but unfortunately in my environment they don't allow any non-standard actions.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 659 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 386 Moderator

#3
chiaraalina Profile Picture

chiaraalina 290

Last 30 days Overall leaderboard