Just… why (are these not being defined by the methods below)? Found some great posts while looking and already applied some of the input (thanks @Noah and @JasonWalker!)
What I’m really after is the four digit number after “WIC_Modules:” in “...; WIC_Modules:4010; bin...” or
“...; zzWIC_Modules:4021; zz...” which appear on the same line of a log file - I need the larger number.
q:if line 1 of file “C:\Users\Bob\Documents\Temp\File.txt” contains (regex “[T]”) then line 1 of file “C:\Users\Bob\Documents\Temp\File.txt” else nothing
A: TX 507717
T: 2.165 ms
q:following text of first (regex “[T]”) of line 1 of file “C:\Users\Bob\Documents\Temp\File.txt”
E: The operator “first” is not defined.
q:following text of first (“%25”&(regex “[T]”)&“%25”) of line 1 of file “C:\Users\Bob\Documents\Temp\File.txt”
E: The operator “concatenate” is not defined.
q:following text of first ((“%25”)&(regex “[T]”)&(“%25”)) of line 1 of file “C:\Users\Bob\Documents\Temp\File.txt”
E: The operator “concatenate” is not defined.
You’re so very close…I think all you are missing is that you need to retrieve the “matches” of the regex, and the “first matches” in particular. I’m not building the text file to test, but I think you can see what I mean with the string operations
q: "TX 507717" contains regex "[T][X]"
A: True
T: 55.721 ms
I: singular boolean
q: regex "[T][X]" of "TX 507717"
E: The operator "regex" is not defined.
q: matches(regex "[T][X]") of "TX 507717"
A: TX
T: 55.642 ms
I: plural regular expression match
q: ("%25" & following text of it & "%25") of first matches(regex "[T][X]") of "TX 507717"
A: %25 507717%25
T: 55.557 ms
I: plural string
q:following texts of last "WIC_Modules:" of preceding texts of first "; bin" of ((line (maximum of line numbers of lines containing "WIC_Modules" of it) of file whose (name of it starts with "jrnl" AND (name of it does not contain "-")) of folder "<computerA>") as string)
A: 4019
T: 770.593 ms
q:following texts of last "WIC_Modules:" of preceding texts of last "; bin" of ((line (maximum of line numbers of lines containing "WIC_Modules" of it) of file whose (name of it starts with "jrnl" AND (name of it does not contain "-")) of folder "<computerA>") as string)
A: 4019
T: 724.745 ms
q:following texts of last "WIC_Modules:" of preceding texts of first matches (regex "\;\s[b][i][n]") of ((line (maximum of line numbers of lines containing "WIC_Modules" of it) of file whose (name of it starts with "jrnl" AND (name of it does not contain "-")) of folder "<computerA>") as string)
A: 4019
T: 679.468 ms
q:following texts of last "WIC_Modules:" of preceding texts of last matches (regex "\;\s[b][i][n]") of ((line (maximum of line numbers of lines containing "WIC_Modules" of it) of file whose (name of it starts with "jrnl" AND (name of it does not contain "-")) of folder "<computerA>") as string)
E: The operator "last matches" is not defined.
q:following texts of last "WIC_Modules:" of preceding texts of last "; zz" of ((line (maximum of line numbers of lines containing "WIC_Modules" of it) of file whose (name of it starts with "jrnl" AND (name of it does not contain "-")) of folder "<computerA>") as string)
A: 4019; bin:1.1; configini:1.0; configusr1:1.7; faflash:2.0; fafrms:1.2; frmAgent:5.0.8; guimgr:3.25n; lib_aci:2.5; lib_bintable:2.0; lib_ctls:2.30p2; lib_dbg:2.13; lib_emvtbl:1.4; lib_ini:1.8; lib_odu:1.9; lib_rfcr:5.26; lib_rsa:4.2; lib_tcpip:2.0.19; lib_vcl:2.4; lib_vhq:2.5; lib_vsd:2.6; lib_xpi:5200w3; libs_other:1.2; pubkey:1.0; ssl:1.0; wicTest:4019; xpifrms:171221; xpivss:1.0; zbin:2.0; zcfg:16.09.01; zcfgini:1.0; zflash:1.5; zfrm:16.09.01; zpci3:16.08.10; zrfidon:16.09.01; zue2ee:on; zusb:16.08.10; zxpifrm:17.10.24
T: 634.779 ms
q:following texts of last "WIC_Modules:" of preceding texts of last "; bin" of ((line (maximum of line numbers of lines containing "WIC_Modules" of it) of file whose (name of it starts with "jrnl" AND (name of it does not contain "-")) of folder "<computerB>") as string)
A: 4019
T: 541.731 ms
q:following texts of last "WIC_Modules:" of preceding texts of last "; zz" of ((line (maximum of line numbers of lines containing "WIC_Modules" of it) of file whose (name of it starts with "jrnl" AND (name of it does not contain "-")) of folder "<computerB>") as string)
A: 4021
T: 268.049 ms
q:following texts of last "WIC_Modules:" of preceding texts of matches ((regex "\;\s[b][i][n]"); (regex "\;\s[z][z]")) of ((line (maximum of line numbers of lines containing "WIC_Modules" of it) of file whose (name of it starts with "jrnl" AND (name of it does not contain "-")) of folder "<computerB>") as string)
A: 4019
E: Singular expression refers to non-unique object.
Are you trying to get the number after WMIC of the last line containing it in the file, or the highest value of multiple WMIC matches on a single line?
The highest value of potentially multiple results. Depending on the version installed the line may contain only “WIC_Modules:”, or “WIC_Modules:” and “zzWIC_Modules:”. In either case these values would appear multiple times in the log so I need to capture the newest/last one listed.
I’m not sure I have a good sample of your data, but if it reads as I think it does, I would probably try to solve this without a regex. I think some of the built-in string operators are well-suited to this.
I’m also not sure whether you want the highest value or the last value that appears in the file, so here are examples of both.
q: lines of file "c:\temp\wic.txt"
A: this line has nothing
A: WIC_Modules:1234;something else;WIC_Modules:2345; bin...
A: WIC_Modules:5678; bin...WIC_Modules:6789; bin...
A: WIC_Modules:7890; bin...WIC_Modules:1984; bin...
A: this line also has nothing
T: 0.258 ms
I: plural file line
q: substrings after "WIC_Modules:" of lines of file "c:\temp\wic.txt"
A: 1234;something else;
A: 2345; bin...
A: 5678; bin...
A: 6789; bin...
A: 7890; bin...
A: 1984; bin...
T: 0.303 ms
I: plural substring
All values in the file
q: preceding texts of firsts ";" of substrings after "WIC_Modules:" of lines of file "c:\temp\wic.txt"
A: 1234
A: 2345
A: 5678
A: 6789
A: 7890
A: 1984
T: 0.358 ms
I: plural substring
Highest value in the file
q: maximum of (it as integer) of preceding texts of firsts ";" of substrings after "WIC_Modules:" of lines of file "c:\temp\wic.txt"
A: 7890
T: 0.382 ms
I: singular integer
Last value in the file
q: (following text of last ":" of it | it) of concatenation ":" of preceding texts of firsts ";" of substrings after "WIC_Modules:" of lines of file "c:\temp\wic.txt"
A: 1984
T: 0.431 ms
I: singular string
Brilliant. I have often seen “substring”, “parenthesized”, and “trimmed string” in my quest for parsing wisdom but haven’t made time to try making sense of them or their use… A big Thanks as always @JasonWalker!