I have a reoccurring line in a multi-line event of the form:
<td> someName someValue someUnits
I'm trying to save each occurrence of this someName someValue someUnits set, but only the last one is saved. I am extracting these with:
[gztd]
REGEX = ^.*<td>\s+(\S+)\s+(\S+)\s+(\S+)
FORMAT = td_name::$1 td_val::$2 td_units::$3
MV_ADD = true
So, for example if I have:
<td> eff 80 %
<td> rate 47 GB
I only get "rate" for td_name and "47" for td_val and never see the "eff" value. What I want to be able to create is a table for each occurrance.
Thx.
I think the problem here is your regex. You're specifying it to match at the beginning of the event (^
), then perform a greedy match (.*
) that will consume as much as it can while still satisfying the rest of the conditions in the regex. So in your case it will match all text right until the last group of <td>\s+(\S+)\s+(\S+)\s+(\S+)
, and so this group is the only one that you will get any values for.
My suggestion on how you could change the regex is to simply remove ^.*
at the beginning.
I think the problem here is your regex. You're specifying it to match at the beginning of the event (^
), then perform a greedy match (.*
) that will consume as much as it can while still satisfying the rest of the conditions in the regex. So in your case it will match all text right until the last group of <td>\s+(\S+)\s+(\S+)\s+(\S+)
, and so this group is the only one that you will get any values for.
My suggestion on how you could change the regex is to simply remove ^.*
at the beginning.
Hi,
That did the trick. Can't say I understand quite yet why the greedy match only gets the last matching set, but you were spot on.
Thanks,
Craig