I'm trying to match data in a gnucash record, without skipping into the next record, so basically needing to stop matching at the closing tag. The record looks thus, for example:
<trn:split> <split:id type="guid">57d4ffe92d4345ddb866e7ebb3429b36</split:id> <split:action>Invoice</split:action> <split:reconciled-state>n</split:reconciled-state> <split:value>-6000/100</split:value> <split:quantity>-6000/100</split:quantity> <split:account type="guid">6b204fbd94654cc9ae53ffec5d8f05fc</split:account> </trn:split>
I am trying to find all records matching a reconciled state for a specific account, however beyond very basic regex matching I can't seem to limit the pattern inside the split, and no matter what I try, vim is selecting across as many records as it can find to match the guid.
Would appreciate some help as I have spent days on this.
Clarification: My goal is to be able to change the
reconciled-state flag on all transactions in an account, so I need to be able to identify that the record belongs to that account. Something along these lines sort-of works:
The look-behind is, I believe, quite expensive and could probably be optimised, however the main issue is that if the immediate guid doesn't match, the search will cross the
</trn:split> until a match is found. In order to contain the search, I need to limit it to 'match anything up to
</trn:split>,' and this is where I am having the problem. I have tried different permutations of
\(<\/trn:split>\)\@! inside the regex but the correct syntax is eluding me.
:help @! gives a basic example that I'm not sure I fully grasp and helpfully states that negative assertions are tricky. It's also difficult to tell what the expression is matching since syntax highlight doesn't show zero-width assertions.
This may not even be the right approach, as advanced examples of matching seem to be few and far between. I think I have reached the point of diminishing returns as I am a bit stuck on what to try next.