Anchor nuances
Note: If you’re familiar with Sensible, this detailed topic is for you. If you’re new to Sensible, see anchor.
Anchor syntax
At first glance, the following anchors may appear to be different syntaxes for finding the same matching text:
Anchor 1
Versus:
Anchor 2
The difference between these two is:
- anchor 1 finds an instance of line B preceded by line A.
- anchor 2 searches after the first instance of line A for a line B, and discards anything earlier in the document.
To clarify the difference, consider a simple document with the following content:
For Anchor 1, Sensible anchors on the last Match array element if it’s preceded by the other array elements in order. "match":all"
finds two anchors. See the following image for an illustration:
- For Anchor 2, Sensible searches after the first instance of
here is an A line
, and discards anything earlier in the document."match":all"
finds four anchors. Notice it doesn’t anchor on the first line B (Here is a B line sneakily inserted before the intro line
) because that instance precedes the start match. See the following image for an illustration:
Try out this example in the Sensible app using the following document and config:
Example document | Download link |
---|
This example uses the following config:
And the output of this example is:
Methods filter anchors
In addition to the match conditions you specify (such as isCaseSensitive
), the method type also influences whether text qualifies as an anchor.
For example, if you specify the Label method, Sensible anchors on text that is a good label candidate. Sensible disqualifies any line as a label that is too far away from other lines, even if it otherwise meets the conditions in the anchor’s parameters.
The following example shows two anchors qualified by the Label method:
Example Config
Example document
The following image shows the example document used with this example config:
Example document | Download link |
---|
Example Output
The example config returns null, but returns data if you specify the Row method instead.
Example Notes
In this example, Sensible filters out the anchor candidates (surrounded by light yellow boxes) because they do not meet the Label method’s proximity requirements. The strings “python” are far enough away from other lines that you should use the Row method here instead.