Hi All,
In a recent thread (which is still being used), VBAXer p45cal helped me to IMPORT a SAS LOG into Excel.
Although there are still some finer details still refined in that thread, I have a parallel question which concerns the parsing of the SAS LOG for various key information.
I have attached a sample workbook of an IMPORTED SAS log. In it I have have 2 worksheets:In "IMPORTLOG" I have in columns C, D and E the output ranges for the SAS LOG parsing.
- "Regex Patterns" which contain various Regex patterns that are required to parse the LOG in a named range called "RegexPatternTable", and;
- "IMPORTLOG" - which contains a named range "WholeLogRng" which is effectively the range to parse.
Basically:
In column C, I have a list of the Key Parsing word that i have stored in the range "RegexPatternTable".
I would like to parse the LOG using the keyword in ColumnC and the corresponding Regex pattern in "RegexPatternTable" to do the following:
Any help is appreciated.
- In column D, I would like to output the number of times that Keyword i.e. Regex pattern for the word, is matched in the LOG.
- In column E, I would like to copy and paste all the examples of the regex match i.e. should go down by the number of matches noted in column E. As such this column dynamically changes with the number of matches found, so not sure how to keep inserting the matched line examples here).
Kind regards