Power Automate String Contains: How to Use It

How-to basics · Updated November 23, 2026

Yes, Power Automate has a string contains function: it is called contains(), and it checks whether a text string contains a specific substring, returning true or false. For example, contains('Hello world', 'world') returns true. This function works in both Power Automate expressions and in the advanced mode of the Condition action, and it is case-insensitive by default.

Background: Why You Need a Contains Check

In Power Automate, you often need to test whether a piece of text—like an email subject, a file name, or a SharePoint column value—contains a certain word or phrase. For instance, you might want to trigger a different branch if an email subject includes “urgent” or if a file name contains “invoice”. The contains() function is the direct way to do that in an expression. It is part of the standard expression functions available in every flow, alongside others like startsWith(), endsWith(), and equals().

How the contains() Function Works

The syntax is simple: contains(<text>, <searchText>). The first argument is the string you are searching in, and the second is the substring you are looking for. The function returns a Boolean value: true if the substring is found, false if not.

Key details:

  • It is case-insensitive: contains('Power Automate', 'power') returns true.
  • It works on strings only. If you pass a number or an object, Power Automate may convert it to a string or throw an error. Use string() to convert a number first if needed.
  • It does not support wildcards. For pattern matching, you would need to use the matchesPattern() function or a regular expression in a separate action.
  • It can also be used on arrays: contains(createArray('a', 'b'), 'a') returns true. This is a common secondary use.

Example in a flow: Suppose you have a variable named EmailSubject. To check if it contains “meeting”, use an expression like:

contains(variables('EmailSubject'), 'meeting')

Using contains() in the Condition Action

The most common place to use contains() is inside a Condition action. In the Condition card, you can switch to “Advanced mode” (by clicking the text link at the top right of the card) and write the expression directly. For example:

contains(outputs('Get_item')?['Title'], 'Report')

This checks if the Title column of a SharePoint item contains the word “Report”. If you prefer the simple mode, you can also select the field, choose “contains” from the operator dropdown, and enter the substring. However, the simple mode only works with dynamic content fields, not with arbitrary expressions.

Common Problems and Misconceptions

One frequent issue is that contains() is case-insensitive, which surprises users who expect a case-sensitive check. If you need case-sensitive matching, you can use the indexOf() function combined with a comparison: greater(indexOf(text, 'Word'), -1) returns true only if the exact case is found. Another misconception is that contains() can check for multiple substrings at once. It cannot; you must use multiple conditions with or or and expressions. For example, to check if a string contains either “cat” or “dog”, you would write:

or(contains(variables('text'), 'cat'), contains(variables('text'), 'dog'))

Also, when using contains() on a null value, Power Automate returns false rather than throwing an error, which can be handy but also masks issues. If you need to check for a null string, use equals(variables('text'), null) first.

Alternatives: startsWith, endsWith, and indexOf

Depending on your need, other functions may be more appropriate:

  • startsWith(<text>, <searchText>) – returns true if the text begins with the search string.
  • endsWith(<text>, <searchText>) – returns true if the text ends with the search string.
  • indexOf(<text>, <searchText>) – returns the zero-based position of the first occurrence, or -1 if not found. This gives you the position and can be used for case-sensitive checks as described above.
  • matchesPattern(<text>, <pattern>) – for regular expression pattern matching, though it is not available in all connectors and may require a premium license.

For example, if you want to check that a filename starts with “Draft_”, use startsWith() instead of contains() to be more precise.

Performance and Best Practices

Using contains() is fast and does not cause any significant performance overhead in a flow. However, be mindful of the size of the string: extremely large strings (e.g., a 10 MB file content) may slow down the flow, but that is rare. Best practices include:

  • Use contains() on small to medium strings; for large documents, consider using a file content check via a different method.
  • If you need to check multiple substrings, combine with or() or and() rather than nesting many conditions.
  • Always test your expression in the expression editor before saving, as syntax errors are common.
  • Remember that contains() is case-insensitive; if that is not desired, use indexOf() as shown.

Frequently Asked Questions

Is contains() case-sensitive in Power Automate?

No, by default contains() is case-insensitive. So contains('Hello', 'hello') returns true. If you need case-sensitive matching, use indexOf() and check if the result is greater than -1.

Can I use contains() on an array?

Yes, contains() works on arrays. For example, contains(createArray('a', 'b'), 'a') returns true. It checks if the array contains an exact element, not a substring of an element.

How do I use contains() with dynamic content from SharePoint or Outlook?

In the Condition action, switch to Advanced mode and write an expression like contains(outputs('Get_item')?['Title'], 'Report'). You can also use the dynamic content picker to insert the field directly into the expression.

What if contains() returns false but I see the text is there?

Check for hidden characters like spaces or line breaks. For example, if the text is “Report ” (with a trailing space), contains(text, 'Report') still returns true because it is a substring. But if you are searching for “Report ” with a space, it may fail. Use trim() on the text first to remove leading/trailing spaces.

Can I use contains() to check if a string contains any of several words?

No, contains() only checks for one substring. You need to combine multiple contains() calls with or() or and(). For example: or(contains(text, 'cat'), contains(text, 'dog')).

Does contains() work with numbers?

It works if you convert the number to a string first. For example, contains(string(12345), '23') returns true. If you pass a number directly, Power Automate may implicitly convert it, but it is safer to use string().

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.