Reading notepad file

Is there any way to fetch the line with a key value, for eg in the below line in a notepad
“z4 = WorksheetFunction.CountIf(Sheets(“Data”).Range(“e” & y), “" & “REFUND” & "”)”

— I need to fetch the entire line using the word REFUND which is the key value, each time that key value can vary and there are close to 100 lines in text file. Any way to retrieve the entire line using the key value?

@shreyaank You can try with this Expression and see if it is extracting only the required data :


1 Like

Thanks it works fine.

What would be the regex expression to find z4 only from the above line?

@shreyaank After you’re able to extract the Line from the above regex, you can Split the Extracted value based on “=” , and take the First Split, in this way :

zValue = Split(ExtractedText,"=")(0).ToString

I would want the regex pattern for finding THE ENTIRE LINE USING only the zvalue -z4
Can you pls share the regex pattern for fetching the the entire line using z4?

@shreyaank - can you share few lines of sample text along with match keyword and expected output?

“z4 = WorksheetFunction.CountIf(Sheets(“Data”).Range(“e” & y), “ " & “REFUND” & " ”)”

I would want to retrieve the entire line using the value z4

@shreyaank Check this Regex Expression and see if it matches all the other data you need :

1 Like

Thanks buddy. It works

1 Like

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