I have a field of text where certain comments are given in square brackets . Some of these comments are numeric page references, e.g. , , , and sone are comments containing non-numeric strings, e.g. [my commrnt here], [this is comment number 2].
I need to do two things:
1. On layout exit, grab the last page reference in the text field, that is, the last numeric stting between square brackets, and replace it with another string In the form [x:y], where x is the original page number, and y is a calculated substitute, which refers to a real page number on a PDF file, generated from bash scripting.
2. On layout enter, grab the value y from the string to use in my bash script, and replace the [x:y] in the text field with the original page ref, [x].
I’m assuming this can be all be achieved with a combination of Position(), Right() and Let() functions, but I am struggling with the first bit, how to grab the last occurrence of text between square brackets. How can this be achieved?