How can I get the string inside the () and make it as my placeholder value on my email body
and how can I save the file path withouth the () ?
Different methods are there,
option 1:
using expression
Save the value to your variable - YourString
Assign output variable using below expression
Split(Split( YourString,“(”)(1).ToString,“)”)(0).ToString
Option 2:
Use Split Text activity
You have to use the activity 2 time
One for splitting using “(” and other for splitting using “)”
then the output will be available in the first part of second activity
@shanti_18 ,
use the below code in assign activity to get the text inside ()
System.Text.RegularExpressions.Regex.Match(yourString, “((.*?))”).Groups(1).Value
Cheers!!
you can use regex to get the values
to extract inside of () this use below pattern - “(?<=().*?(?=))”
Take one assign activity and use below expresion
strInside_Value = System.Text.RegularExpressions.Regex.match(yourstring,“(?<=().*?(?=))”).tostring
Take second assign activity, use below expression
to remove the brackets from your string use below expression
strfilepath = System.Text.RegularExpressions.Regex.Replace(filePath, “([^)]*)”, “”)
Hi @shanti_18
Use this expression:
[ extractedString = Split(Split(YourString, “(”)(1).ToString, “)”)(0).ToString ]
Or use two Split Text activities, one to split by “(” and the second to split by `“)”, getting the result from the first part of the second split.
If you found helpful , mark as solution thanks
strfilepath is the filename without () right?
Yes, strfilepath is the filename without the parentheses () if you used the Replace
method to remove them. For example:
strfilepath = YourString.Replace(“(”, “”).Replace(“)”, “”)
can i send the strfilepath as an attachment to my email?
it should be
strfilepath = C:\RPA\HTI-MP-PO-MM-DD-YYYY upon sending
strfilepath="C:\RPA\"+Input.Split("(")(1).ToString.Trim(")"c)
@shanti_18
Yes, you can send strfilepath as an attachment in your email. To format the strfilepath as C:\RPA\HTI-MP-PO-MM-DD-YYYY upon sending, you just need to dynamically build the path using the current date.
Example:
strfilepath = “C:\RPA\HTI-MP-PO-” & Now.ToString(“MM-dd-yyyy”) & “.txt”
@shanti_18 , It just remove brackets and text wont remove inside of the brackets
If you want remove the entire thing whatever data is there inside of the brackets
use below expression
strfilepath = System.Text.RegularExpressions.Regex.Replace(inputString, “([^)]*)”, “”
newfilename as string
value System.Text.RegularExpressions.Regex.Replace(FilePath(0), “(.*?)”, “”).Trim
how can I make this as an attachment to my email sending?
try to look out in you mail activity there will be a option to attach the files, there you need to give full file path.
if you are storing it in a variable verify that variable contains full path of the file or not.
then pass that variable in attachment section
okay, but how can I rename the file? to the new format
for that you can use rename file activity to rename the file
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.