24351RE: [Clip] Advice to add 'Tabs' to data.
- Feb 14, 2014
Thank you! One of the things I have been meaning to get a better handle on is exactly this. With this example, I should be able to apply it to my cases.
> One of the things I have been doing is enclosing multiple paren
> phrases inside an (?= phrase), so that it won't capture, but INo, also parens (or a 'group') inside a Lookaround are captured. Test...
> wonder if it is captured anyway.
^!Find "\b^%Cheeses%\b(?=(\x20cheese))" RS
against 'Cheddar cheese'. The output will be 'cheese' that is captured with the group inside the Lookahead Assertion.
BTW: I think sometimes it's rather difficult to find out whether the speed of clip execution depends on the search pattern, the clip code or the way it consumes memory. Certain patterns, for example, could cause serious stack problems and lead to wrong results -- cf my message #22824 of June 20, 2012.
Also there can be clips which are rather slow because the RegEx pattern causes a lot of backtracking. For example, take this line...
and multiply it to 10,000 lines. Now run the following clip against those lines:
^!Find "+.*(aa|bb)" WR
For me, the clip needs almost a minute to find out that there is no match. That is, that there is no line that ends with 'aa' or 'bb'. However, the problem is not in NT or the clip code but in the RegEx. The trick is to suppress the backtracking because, actually, it isn't needed here. With an Atomic Group...
^!Find "(?>+).*(aa|bb)" WR
the job is done in two seconds.
- << Previous post in topic Next post in topic >>