I have the following text string
@[8,0CF25058-55D2-E811-8145-5065F38B02E1,"Jane Doe"] @[8,033D8C19-0EEB-E711-810E-5065F38B02E1,"John Smith"] What does this look like when the text is added to a note?
I want to remove parts of the string to make easier to read. There could be any number of items to remove but the format will be the same. This one would ideally result in the following.
Jane Doe John Smith What does this look like when the text is added to a note?
If the original text string looked like this.
@[8,0CF25058-55D2-E811-8145-5065F38B02E1,"Jane Doe"] What does this look like when the text @[8,033D8C19-0EEB-E711-810E-5065F38B02E1,"John Smith"] is added to a note?
Result should be the same.
Jane Doe What does this look like when the text John Smith is added to a note?
Please help
Solved! Go to Solution.
Hi!
The kind of scenario that can be solved with regex easily and takes hours to find out a good solution in WDL 😋
EDIT: I had finally the chance to test it, fixed some errors, now working!
Let's assume you store your input string in a variable called 'myInputString'
I would do the following
Create a variable called 'myOutputString' type string
Create an aux variable, let's call it 'auxArray' type Array, assign as value the following expression:
split(replace(replace(variables('myInputString'),']','] '),'@',''),'[')
Then I would add an Apply to Each, using variable 'auxArray' as its input.
Inside the apply to each:
-add a Condition, select 'contains':
on the left side add the expression
item()
on the right side add the character ]
Now, on the true branch of your condition:
- add an Append to string variable: name myOutputString, assign as value the following expression:
split(item(),'"')[1]
-add a second Append to string variable: name myOutputString, assign as value the following expression:
split(replace(item(),']',''),'"')[2]
Now, on the false branch of your condition:
-add a third Append to string cariable: name myOutputString, assing as value the following expression:
item()
After the Apply to Each, add a dummy Compose action block, assign as its input the variable 'myOutputString'. Execute the flow and inspect dummy Compose contents
Here you are the results with both examples you provided:
Jane Doe John Smith What does this look like when the text is added to a note?
Jane Doe What does this look like when the text John Smith is added to a note?
Hope this helps
Proud to be a Flownaut!
Hi @cholst
Continuing to your post from here: https://powerusers.microsoft.com/t5/General-Power-Automate/Get-Value-s-from-text-string/m-p/491472#M...
Once, you have individual items, you can use another split to split on the GUID at the , so for a string like: [8,0CF25058-55D2-E811-8145-5065F38B02E1,"Jane Doe"] It will return you with three items. you can then access the last one "Jane Doe"] and use the replace function to replace the " and ].
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi!
The kind of scenario that can be solved with regex easily and takes hours to find out a good solution in WDL 😋
EDIT: I had finally the chance to test it, fixed some errors, now working!
Let's assume you store your input string in a variable called 'myInputString'
I would do the following
Create a variable called 'myOutputString' type string
Create an aux variable, let's call it 'auxArray' type Array, assign as value the following expression:
split(replace(replace(variables('myInputString'),']','] '),'@',''),'[')
Then I would add an Apply to Each, using variable 'auxArray' as its input.
Inside the apply to each:
-add a Condition, select 'contains':
on the left side add the expression
item()
on the right side add the character ]
Now, on the true branch of your condition:
- add an Append to string variable: name myOutputString, assign as value the following expression:
split(item(),'"')[1]
-add a second Append to string variable: name myOutputString, assign as value the following expression:
split(replace(item(),']',''),'"')[2]
Now, on the false branch of your condition:
-add a third Append to string cariable: name myOutputString, assing as value the following expression:
item()
After the Apply to Each, add a dummy Compose action block, assign as its input the variable 'myOutputString'. Execute the flow and inspect dummy Compose contents
Here you are the results with both examples you provided:
Jane Doe John Smith What does this look like when the text is added to a note?
Jane Doe What does this look like when the text John Smith is added to a note?
Hope this helps
Proud to be a Flownaut!
Proud to be a Flownaut!
very close. In this example
@[8,0CF25058-55D2-E811-8145-5065F38B02E1,"Jane Doe"] What does this look like when the text @[8,033D8C19-0EEB-E711-810E-5065F38B02E1,"John Smith"] is added to a note?
I would want the end result to be
[8,0CF25058-55D2-E811-8145-5065F38B02E1,"Jane Doe"] [8,033D8C19-0EEB-E711-810E-5065F38B02E1,"John Smith"]
User | Count |
---|---|
22 | |
15 | |
14 | |
10 | |
9 |
User | Count |
---|---|
48 | |
29 | |
28 | |
25 | |
23 |