How to Split a String between two characters using Power Automate?

Do you want to split the string between two characters using Power Automate flow? Then, this Power Automate tutorial is for you. Here, I will show you how to split a string between two characters using Power Automate with different examples.

Scenario:

Recently, I got a requirement where I needed to split strings between two characters using Power Automate flow. For example, if we have values like below

 PowerPlatforms@PowerAutomate&PowerBI

Once the string has been extracted, which is presented between two characters, it displays the value below:

PowerAutomate

Here, I will explain two different ways of splitting the string between two characters using the Split() function and IndexOf expression in Power Automate with static and dynamic examples.

Now, we will create a flow to split the string between two characters using Power Automate flow.

Split String between two characters using Power Automate

Let us see how to split a string between two characters using Power Automate flow,

Example – 1: (Using Split function())

In this example, I will show you how to split a string between two characters using the Split() function in Power Automate

Step-1:

Create an instant cloud flow with a manual trigger, add a new step, choose to compose data operation, and pass the below value as input.

 PowerPlatforms@PowerAutomate&PowerBI
power automate split string between two characters

Step-2:

And another compose data operation, to split the first character presented in the string input.

first(split(outputs('String_Values_with_characters'),'&'))
how to split string in power automate

Step-3:

Add a new step and select the compose data operation to split the second character presented in the string input.

how to split string in power automate flow

Step-4:

save and run the flow; here, in the Output of the compose data operation, we can see the expected result.

power automate get string between two characters

This is how to split a string between two characters using the Split() function in Power Automate.

Example – 2:

In this example, I will show you how to split a string between two characters using the IndexOf expression in Power Automate flow.

Step-1:

Create an instant cloud flow with a manual trigger, add a new step, choose the compose data operation, and pass the below value as input.

 PowerPlatforms@PowerAutomate&PowerBI
power automate split string between two characters

Step-2:

Add a compose data operation and use the below expression to get the @ position

add(int(indexOf(outputs('String_Values_with_two_characters'), '@')), 1)
split string to get a string between two characters in Power Automate

Step-3:

To get the & position, add another compose data operation and use the below expression.

int(indexOf(outputs('String_Values_with_two_characters'), '&'))
power automate split function to split string

Step-4:

To get the difference between two characters, add a compose data operation and use the below formula:

sub(outputs('Get_Index_of_&'),outputs('Get_Indexof_@'))
extract string between two characters in power automate

Step-5:

To get the extracted string, add a compose data operation and use the below substring () expression.

substring(outputs('String_Values_with_two_characters'),outputs('Get_Indexof_@'),outputs('Get_Last_Index'))
extract string between two characters in power automate flow

Step-6:

save and run the flow by selecting the run flow option. Once the flow runs successfully like below, We can see the expected output in the extracted string compose data operation.

How to extract string between two characters in power automate

This is how to split a string between two characters using the IndexOf expression in Power Automate.

Example – 3:

In this example, I will show you how to split a string between two characters from the SharePoint list text column using the Split() function in Power Automate flow.

Here, I am going to use the below Technologies SharePoint list, Consisting of

  • Technology – default title column
  • StringWithTwoCharacters – Single line of text type
How to extract string between two characters in power automate flow

Now, we will create a flow to split a string between two characters for the StringWithTwoCharacters column presented in the SharePoint list.

Step-1:

Create an instant cloud flow with a manual trigger, select Get items action from action triggers, and configure the required parameters.

  • Site Address – select the SharePoint site address from the dropdown
  • List Name – choose the SharePoint list. Here I have selected my technology list
Example to extract string between two characters in power automate flow

Step-2:

Add a new step, choose an Apply to each control, and pass the value from the dynamic content

split string between two characters in power automate

Add Another compose data operation is to split the first character presented in the StringWithTwoCharacters field in the SharePoint list.

first(split(items('Apply_to_each')?['StringWithTwoCharacters'],'&'))
split string between two characters in power automate flow

Add another compose data operation to split the second character presented in the StringWithTwoCharacters field

last(split(outputs('Compose'),'@'))
how to split string between two characters in power automate

Now, we will update the StringWithTwoCharacters field after extracting the string value between two characters.

For that, Add a new step, choose the Update item action from action triggers, and provide the below parameters:

  • Site Address – select the SharePoint site address from the dropdown
  • List Name – choose the SharePoint list. Here, I have selected my technology list
  • ID – choose the ID from dynamic content values

In the StringWithTwoCharacters field, pass the outputs of the previous compose data operation

Outputs('Split_second_character')
how to split string between two characters using power automate

Step-3:

save and run the flow once the flow runs successfully like below:

get string between two characters in power automate

We can see it extracts and updates the string between two characters in the StringWithTwoCharacters field presented in the SharePoint list.

get string between two characters in power automate flow

This is how to split a string between two characters from the SharePoint list text column using the Split() function using flow.

Example – 4:

In this example, I will show you how to split a string between two characters from the SharePoint list text column using the IndexOf expression in Power Automate flow.

Here also, I am going to use the below Technologies SharePoint list with different values.

How to get string between two characters in power automate flow

Step-1:

Create an instant cloud flow with a manual trigger, select Get items action from action triggers, and configure the required parameters.

  • Site Address – select the SharePoint site address from the dropdown
  • List Name – choose the SharePoint list. Here I have selected my technology list
Example to extract string between two characters in power automate flow

Step-2:

Add a new step, choose an Apply to each control, and pass the value from the dynamic content

split string between two characters in power automate

Add Another compose data operation to get the @ position presented in the StringWithTwoCharacters field in the SharePoint list.

add(int(indexOf(items('Apply_to_each')?['StringWithTwoCharacters'],'@')),1)
How to get string between two characters in power automate

To get the & position, add another compose data operation and use the below expression.

int(indexOf(items('Apply_to_each')?['StringWithTwoCharacters'], '&'))
extract string between two characters using power automate

To get the difference between two characters, add a compose data operation and use the below formula:

sub(outputs('Get_Index_of_second_character'),outputs('Get_Index_of_first_character'))
extract string between two characters using power automate flow

To get the extracted string, add a compose data operation and use the below substring () expression.

substring(items('Apply_to_each')?['StringWithTwoCharacters'],outputs('Get_Index_of_first_character'),outputs('Get_last_index'))
How to extract string between two characters using power automate flow

Now, we will update the StringWithTwoCharacters field after extracting the string value between two characters.

For that, Add a new step, choose the Update item action from action triggers, and provide the below parameters:

  • Site Address – choose the SharePoint site address from the dropdown
  • List Name – select the SharePoint list. Here, I have selected my technology list
  • ID – from dynamic content value select the ID

In the StringWithTwoCharacters field, pass the outputs of the previous compose data operation (i.e.Extracted string value)

outputs('Extracted_string_value')
How to extract string between two characters using power automate

Step-3:

save and run the flow once the flow runs successfully like below:

how to split string between two characters in power automate flow

We can see it extracts and updates the string between two characters in the StringWithTwoCharacters field presented in the SharePoint list.

how to split string between two characters using power automate flow

This is how to split a string between two characters from the SharePoint list text column using the IndexOf expression using flow.

Split string between multiple characters using Power Automate

Let us see how to split a string between multiple characters using Power Automate flow,

Example – 1: (static way)

In this example, I will show you how to split a string between multiple characters using the Split() function in Power Automate

  • Create an instant cloud flow with a manual trigger, add a new step, choose compose data operation, and pass the below value as input.
PowerPlatforms@PowerAutomate&PowerBI&PowerApps&PowerVitualAgent&PowerPages
How to split string between Multiple characters using Power Automate
  • Another compose data operation is to split the first character presented in the string input.
first(split(outputs('String_Value'),'&'))
How to split string between Multiple characters using Power Automate flow
  • Add a new step and select the compose data operation to split the second character presented in the input string.
last(split(outputs('String_Value'),'@'))
split string between Multiple characters using Power Automate flow
  • Add a compose data operation to split the values from the previous compose data operation.
split(outputs('Second_Split'),'&')
split string between Multiple characters using Power Automate
  • To display the output value based on the index value, pass the below expression; here, I have passed the index value as [3].
outputs('Last_Split')[3]
split string between Multiple characters in Power Automate
  • Save and run the flow by clicking on the run flow option. Here, in the Output of the compose data operation, we can see the expected result.
split string between Multiple characters in Power Automate flow

This is how to split a string between multiple characters using the Split() function in Power Automate.

Example – 2: (dynamic way)

In this example, I will show you how to split a string between multiple characters from the SharePoint list text column using the Split() function in Power Automate flow.

Here, I am going to use the below Technologies SharePoint list, which consists of

  • Technology – default title column
  • StringWithMultipleCharacters – Multi line of text type
split string between Multiple invalid characters using Power Automate

Step-1:

Create an instant cloud flow with a manual trigger, select Get items action from action triggers, and configure the required parameters.

  • Site Address – select the SharePoint site address from the dropdown
  • List Name – choose the SharePoint list. Here I have selected my technology list
Example to split string between Multiple characters using Power Automate

Step-2:

Add a new step, choose an Apply to each control, and pass the value from the dynamic content

Example to split string between Multiple characters in Power Automate

And another compose data operation, to split the first character presented in the string input.

first(split(items('Apply_to_each')?['StringWithMultipleCharacters'],'&'))
How to split string between Multiple characters in Power Automate

Add a new step and select the compose data operation to split the second character presented in the input string.

last(split(items('Apply_to_each')?['StringWithMultipleCharacters'],'@'))
Power Automate split string between Multiple characters

Add a compose data operation to split the values from the previous compose data operation.

split(outputs('Second_Split'),'&')
Extract string between Multiple characters using Power Automate

Now, we will update the StringWithMultipleCharacters field based on the index value

For that, Add a new step, choose the Update item action from action triggers, and provide the below parameters:

  • Site Address – select the SharePoint site address from the dropdown
  • List Name – choose the SharePoint list. Here, I have selected my technology list
  • ID – choose the ID from dynamic content values

In the StringWithMultipleCharacters field, pass the outputs of the previous compose data operation with the index value; here, I have passed the index value as [2].

outputs('Last_Split')[2]
How to split string between Multiple characters in Power Automate flow

Step-3:

save and run the flow once the flow runs successfully like below:

Power Automate split string between Multiple invalid characters

we can see it extracts and updates the string in the StringWithMultipleCharacters field presented in the SharePoint list.

Power Automate split string between Multiple invalid characters example

This is how to split a string between multiple characters from the SharePoint list text column using the Split() function in the Power Automate flow

Example-3: (static way)

In this example, I will show you how to split a string between multiple invalid characters using the Split() function in Power Automate

Step-1:

Create an instant cloud flow with a manual trigger, add a new step, choose the compose data operation, and pass the below value as input.

PowerPlatforms@PowerAutomate%PowerBI$PowerApps#PowerVitualAgent*PowerPages|PowerFX
How to split string between Multiple invalid characters in Power Automate flow

Step-2:

Add a new step and select the compose data operation to replace the invalid characters presented in the input string with a comma, use the below expression

replace(replace(replace(replace(replace(replace(outputs('String_Value'),'@',','),'%',','),'$',','),'#',','),'|',','),'*',',')
How to split string between Multiple invalid characters in Power Automate

Step-3:

Add a compose data operation, to split the values from the previous compose data operation.

split(outputs('Replaced_String_value'),',')
split string between Multiple invalid characters in Power Automate

Step-4:

To display the output value based on the index value, pass the below expression; here, I have passed the index value as [1].

outputs('Split_values')[1]
split string between Multiple invalid characters in Power Automate flow

Step-5:

save and run the flow by clicking on the run flow option. Here, in the Output of the compose data operation, we can see the expected result.

split string between Multiple invalid characters using Power Automate flow

This is how to split a string between multiple invalid characters using the Split() function in Power Automate

Example-4:(dynamic way)

In this example, I will show you how to split a string between multiple invalid characters from the SharePoint list text column using a split() function in Power Automate flow.

Here also, I am going to use the below Technologies SharePoint list with different invalid characters.

Example to split string between Multiple characters using Power Automate flow

Step-1:

Create an instant cloud flow with a manual trigger, select Get items action from action triggers, and configure the required parameters.

  • Site Address – select the SharePoint site address from the dropdown
  • List Name – choose the SharePoint list. Here I have selected my technology list
Example to split string between Multiple characters using Power Automate

Step-2:

Add a new step, choose an Apply to each control, and pass the value from the dynamic content

Example to split string between Multiple characters in Power Automate

Add a new step and select the compose data operation to replace the invalid characters presented in the input string with a comma, use the below expression

replace(replace(replace(replace(replace(replace(items('Apply_to_each')?['StringWithMultipleCharacters'],'@',','),'%',','),'$',','),'#',','),'|',','),'*',',')
Extract string between Multiple characters in Power Automate flow

Add a compose data operation to split the values from the previous compose data operation.

split(outputs('Replace_invalid_characters'),',')
Extract string between Multiple characters in Power Automate

Now, we will update the StringWithMultipleCharacters field based on the index value

For that, Add a new step, choose the Update item action from action triggers, and provide the below parameters:

  • Site Address – select the SharePoint site address from the dropdown
  • List Name – choose the SharePoint list. Here, I have selected my technology list
  • ID – choose the ID from dynamic content values

In the StringWithMultipleCharacters field, pass the outputs of the previous compose data operation based on the index value

outputs('Split_the_string_value')[1]
Extract string between Multiple characters using Power Automate flow

Step-3:

save and run the flow once the flow runs successfully like below:

Extract string between Multiple invalid characters in Power Automate

we can see it extracts and updates the string in the StringWithMultipleCharacters field presented in the SharePoint list.

Extract string between Multiple invalid characters in Power Automate flow

This is how to split a string between multiple invalid characters from the SharePoint list text column using a split() function in Power Automate flow.

Conclusion

I hope you got an idea of how to split a string between two characters in Power Automate flow.

Here, I have explained two different ways of splitting the string between two characters using the Split() function and IndexOf expression in Power Automate with static and dynamic examples.

You may also like:

>