Hi,
I’m attaching a sample txt file ,first it has to read that text file and then,
Sample1.txt (35 Bytes)
i need to extract the 4589 and store that in to a variable, after that in a loop it has to display ADD/SUB/MULTIPLY separately in message box and has to store in to a variable.
Can anyone please help me to solve this.
pikorpa
(Piotr Kołakowski)
February 9, 2024, 3:28pm
3
hey @Chippy_Kolot
try this:
System.Text.RegularExpressions.Regex.Match(fileContent, "Invoice : (\d+)").Groups(1).Value
need to display
ADD
SUB
MULTIPLY,in loop using seperate message box.
rlgandu
(Rajyalakshmi Gandu)
February 9, 2024, 3:29pm
5
@Chippy_Kolot
System.Text.RegularExpressions.Regex.Match(Input,(?<=Invoice.*\s+)\d+).Value
mkankatala
(Mahesh Kankatala)
February 9, 2024, 3:29pm
6
Hi @Chippy_Kolot
You can use the regular expressions to extract the required output,
- Assign -> Output = System.Text.RegularExpression.Regex.Match(Input,"(?<=Invoice :\s*)\d+").Value
Use the below regex for ADD/SUB/MULTIPLY
(?<=\/)[A-Z]+|[A-Z]+(?=\/)
you can use the above regex in Find Matching Patterns activity and the output is in Collection of matches, you can use for each to iterate the each item in the collection.
Hope it helps!!
vrdabberu
(Varunraj Dabberu)
February 9, 2024, 3:30pm
7
Hi @Chippy_Kolot
To extract Add/SUB?MULTIPLY use below regex:
Assign-> Input= "Invoice : 4589
ADD/SUB/MULTIPLY"
Assign-> Output= System.Text.RegularExpressions.Regex.Match(Input,"(?<=\d+\s*)[A-Z/]+").Value.Trim()
Assign-> InvoiceNumber= System.Text.RegularExpressions.Regex.Match(Input,"(?<=Invoice\s+\:\s+)\d+").Value.Trim()
Regards
rlgandu
(Rajyalakshmi Gandu)
February 9, 2024, 3:37pm
9
@Chippy_Kolot
In message box:String.Join(Environment.NewLine, inputString.Substring(inputString.IndexOf(":") + 1).Split({"/"}, StringSplitOptions.RemoveEmptyEntries))
Str_Number=System.Text.RegularExpressions.Regex.Match(Input,"(?<=Invoice.*\s+)\d+").Value
system
(system)
Closed
February 12, 2024, 3:37pm
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.