How to check if the last line of text contains special characters

Dears,
How to check if the last line of text contains special characters?I always need to check the file’s last line if it contains lv.exe.I also refer to the topic:How to check if last line of text file contains one word?, but it returns to the error:2020-01-13_11-46-15

sample.txt (774 Bytes)

Try This
datatest.Split({vbcrlf},StringSplitOptions.None)(datatest.Split({vbcrlf},StringSplitOptions.None).Length-2).Trim.ToString.Contains("lv.exe")

Here Datatest is Output Varible of Read Text File

1 Like

Hi
welcome back to uipath community
Kindly try like this
bool_output = System.Text.RegularExpressions.Regex.IsMatch(strinput.tostring.Split(Environment.Newline.ToArray()).Last().ToString,“(.exe)”)

Cheers @bfhuang

1 Like

Can you please tell me where is the part which looks for special characters?

@Palaniyappan

Fine
.exe is the one we want to search and to ensure whether its there or not right… buddy
for that we can directly mention that instead of mentioning the special characters \W
or
if we know the exact special character then we can include that in the ISMATCH argument, as if we mention \W it will even include Space as a special non word character

thats why mentioned .exe as a match to be found directly

@iVishalNayak

1 Like

Thank You

1 Like

Cheers @iVishalNayak

thanks a lot, it works.

This also works, thanks all the same.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.