I'm using the Search Variable Using Regular Expression and while my current regex is 'working', it only works for Variables (text files) that have a specific number of lines, and I have some files that have less or more lines.
Basically I am importing a text file with multiple lines. I need to capture each individual line to a unique capture group which then will save 'capture groups to Variables in the Action.
Here's an examples of the Text File:
IP
Test
Open
Genre
00:49
Dm
112BPM
Some lines may be blank, and while this file has 8 lines, some may have only 6 lines.
This regular expression will work, but only for 8 lines. If I add another blank line it won't work. If I remove any single line, it won't work.
To be clear, this needs to have 8 total capture groups (for the KM Action), but it still needs to work even if there are 'less than 8 lines' in the text file.
May I ask why you are using this approach, of saving every line to a KM Variable?
Without knowing your objective or complete workflow, it might make more sense to use a For Each action with a Lines collection from a file. Something like this:
Hi, yeah I uploaded an image of the Action I'm using to my original post - basically what you just posted.
Your regex definitely works for 6-8 lines, but is there a way to modify it for anywhere between maybe 4 - 8 lines? It's possible that I won't ever have just 4 lines, but I'm just trying to cover my bases now just in case.
This works but I have made some changes and have a new issue. I changed the search data and I only want to capture the data after the colon + space, so for Volume: I just want '200'. I have tried modifying the regex and I just can't seem to crack this one and still keep the number of lines variable. Any ideas?