@RetRoland this is an interesting approach, as is @EricShulman’s
- It suggests an approach I have being looking for for a long time. The ability to test the input titles meets various formats.
Of interest to me is we coufd replace all alphabetic with an A and number with an N then rejoin them, The Result would then be something like AAAANNNN for your example data. We can then test this against a predefined format like [match[AAAANNNN]]
to test if the input has the same “format”.
To make this reusable we can redefine Erics [0123456789]
as follows and add other sets;
\define numbers() 0123456789
- Note I use define because this is all that is required, for literals.
\define numbers() 0123456789
\define my-format() AAAANNNN
{{{ [[LIDP3016]split[]] :map[<numbers>search:title<currentTiddler>then[N]else[A]] +[join[]] +[match<my-format>then[yes]else[no]] }}}
However we can move this logic further into functions so you can test any title matches any format we define, as a literal or a name.
[[title]test.format[AAAANNN]...
or [[title]test.format<customer. Code>...
In closing I will try and share back my developments. But I would point out the regular expressions could achieve similar but they require knowledge or regular expression formats.
- This approach works on fixed length formats but padding and other methods could be used to support variable length fields.
- For anyone in the know my use of A, N (or 0) and also X belies experience with Cobol.