Get entire row from a table

Hello guys,

I am working with an old desktop application from which I can not retrieve a table using Data scrapping. Hence, I am reading the table as text.

If I have the string “INVALIDO TOTAL” under the column “Condicion” and “N” under the column ¿Inválido PV?, I need to get all the information from that ROW. This is the text that I get using Get Visible Text and doing some other string manipulations:

SOO, I have done the validations that I need using this Regular Expression: If the string “N” is preceded by a date and this date is preceded by the string “INVALIDO TOTAL” this table has the conditions that I need.

(INVALIDO TOTAL)\s(\d{2}(/)\d{2}(/)\d{4})\s([N])

Therefore, I need to get that entire row but I do not know how since the first two words “TITULAR” and “MASCULINO” can be anything else (the thing that matters the most is “INVALIDO TOTAL” and “N”)

Any help would be amazing, thanks in advance!

Hi @ahzaradsh
What about table extraction from the application page?.Are you able to extract it as table?

Hi @ahzaradsh,

Could you try this:

^.*INVALIDO TOTAL [0-9]{2}/[0-9]{2}/[0-9]{4} N$

Try different scenarios for you text and see if it works or if it fails in some scenarios, maybe needs some tweaking.

Quick Tip, try using CHAT GPT for regex.

CHAT GPT output:

Sure, here is a regular expression that would match the text “TITULAR MASCULINO INVALIDO TOTAL 20/06/1959 N” only when the letter “N” and the sentence “INVALIDO TOTAL” is present, even if the word “TITULAR”, “MASCULINO” and the date are dynamic:

cssCopy code

^.*INVALIDO TOTAL [0-9]{2}\/[0-9]{2}\/[0-9]{4} N$

Explanation of the regex:

  • ^ asserts the position at the start of the string
  • .* matches any character (except for a newline) zero or more times
  • INVALIDO TOTAL matches the exact text “INVALIDO TOTAL”
  • [0-9]{2}\/[0-9]{2}\/[0-9]{4} matches the date pattern “dd/mm/yyyy”
  • N matches the letter “N”
  • $ asserts the position at the end of the string

This regular expression asserts that the string must contain “INVALIDO TOTAL” followed by a date in the format “dd/mm/yyyy” and end with “N” . The words “TITULAR” and “MASCULINO” can be any word or characters before “INVALIDO TOTAL”

Note that this regex assumes that date is in format “dd/mm/yyyy”. If the date is in different format, the regex should be adjusted accordingly.


can you try with this code

strRow = yourStringVar.Split({vbLf},StringSplitOptions.RemoveEmptyEntries)(2)