I have a recurring problem when regexping in TW: Is there a sure fire “do it this way” to insert the regex in a TW filter operator? I usually mess around until things are solved or I find other solutions but it would be good if there was some kind of “always do this” rule of thumb.
For example, googling these matters often results in recommenations like this but obviously a quare bracket would not be usable directly in a filter operator. The doc regexp Operator (Examples) has this method to overcome, specifically, “square brackets”:
<$set name="digit-pattern" value="[0-9]{2}">
<<list-links "[regexp:title<digit-pattern>]" field:"title">>
</$set>
…but I’m not sure this solves all problems as I don’t think we can escape characters (can we?)
For example, using this regexp service (as shared by @Mohammad -thanks!) I get got this pattern:
(\[.+?\][\s\S]+?)(\n\n)
— it is supposed to split a text at every second row (I gave it a sample text)
…and the only way to make sure the created pattern works as expected is to actually see it in action (how else!?)… but the following doesn’t seem to achieve it:
<$let split="(\[.+?\][\s\S]+?)(\n\n)">
<$list filter="""[<mytext>splitregexp<split>]""" >
</$list>
</$let>
…so how am I to know what’s wrong with it… :-/