Regex (Last Line txt)

Good day:

I need help. I want read the last line of the txt. Right Now use File.ReadAllLines( UrlLog).Last(); but i dont work. The last line may be contain ANS1329S Server out of data storage space. I think use regex, but i dont sure how can be make that. I need read the all last line.

thanks

Try this regex expression to extract last line

(?<=\r?\n).*$

LastLine.xaml (4.8 KB)

I finish using it. The result is white or empty

This is a sample of txt

Network data transfer rate:
Aggregate data transfer rate:
Objects compressed by:
Total data reduction ratio:
Elapsed processing time:
ANS1329S Server out of data storage space (this is the last line)

I will always need the line below Elapsed processing time

(?<=Elapsed processing time\:)[\w\W]+

Excuse me, could you give me the code uipath?. Thank you . I use this expression but i have some error. System.Text.RegularExpressions.Regex.Match(outText, (?<=Elapsed processing time:)[\w\W]+).ToString

LastLine.xaml (4.8 KB)

I got it
00:55:44
ANS1329S Server out of data storage space

How can i get only the last line?

Hi @Julian_Yamid_Torres_Torre
try this method

System.Text.RegularExpressions.Regex.Match(input,"(?<=Elapsed processing time:\S+)\s+.*$").Value.ToString

Regards
Nived N
Happy Automation

I find myself using the following Regex:
A. System.Text.RegularExpressions.Regex.Match (outText, “(? <= Elapsed \ processing \ time \ : ) [\ w \ W] +”). Value .
The result is : 00:55:44
ANS1329S Server out of data storage space

B.
System.Text.RegularExpressions.Regex.Match(outText,"(?<=\r?\n).*$").value
The result is : empy

C. System.Text.RegularExpressions.Regex.Match(outText, “(?<=Elapsed processing time:\r?\n?).+”).value
The result is 00:55:44

D. System.Text.RegularExpressions.Regex.Match(outText,"(?<=Elapsed processing time:\S+)\s+.*$").Value
The result is empty

Share my code uipath
This is the sample txt:
Total number of objects inspected: 1
Total number of objects archived: 50
Total number of objects updated: 0
Total number of objects rebound: 0
Total number of objects deleted: 0
Total number of objects expired: 0
Total number of objects failed: 0
Total number of objects encrypted: 0
Total number of objects grew: 0
Total number of retries: 0
Total number of bytes inspected: 72.04 GB
Total number of bytes transferred: 72.01 GB
Data transfer time: 969.62 sec
Network data transfer rate: 77,873.57 KB/sec
Aggregate data transfer rate: 22,575.14 KB/sec
Objects compressed by: 0%
Total data reduction ratio: 0.06%
Elapsed processing time: 00:55:44
ANS1329S Server out of data storage space

Comments.xaml (5.8 KB)
Download.xaml (7.5 KB)

is it possible to share the sample data u used ?

This is the sample txt:
Total number of objects inspected: 1
Total number of objects archived: 50
Total number of objects updated: 0
Total number of objects rebound: 0
Total number of objects deleted: 0
Total number of objects expired: 0
Total number of objects failed: 0
Total number of objects encrypted: 0
Total number of objects grew: 0
Total number of retries: 0
Total number of bytes inspected: 72.04 GB
Total number of bytes transferred: 72.01 GB
Data transfer time: 969.62 sec
Network data transfer rate: 77,873.57 KB/sec
Aggregate data transfer rate: 22,575.14 KB/sec
Objects compressed by: 0%
Total data reduction ratio: 0.06%
Elapsed processing time: 00:55:44
ANS1329S Server out of data storage space

Hi @Julian_Yamid_Torres_Torre

try this way
System.Text.RegularExpressions.Regex.Match(outText,"(?<=Elapsed processing time:\s\S+)\s+.*$").Value

Regards,
Nived N
Happy Automation

Excuse me, can you share uipath code?.

Thanks