Regex in Find&Replace with fields

Hi.
I want to replace the string “on page NN” with the string “Above/Below” where

NN is the page number of a heading or figure reference and “Above/below” is the Above/below of the same reference.

Example:
In my text I have

See “Using styles” on page 23.

and I want

See “Using styles” below.

I don’t know how a regexp can detect a field reference.

If your purpose is only to generate “See above/below”, this can be done with standard cross-references.

For “See page <cross_ref>”, you select Page in Insert reference to for the field.

To get “above” or “below”, select Above/Below in Insert reference to instead of Page. Writer will do the math for you and use the appropriate word depending on relative position of cross-reference and anchor.

I know that. I want a global way to change 100’s of references in a book. I also want to now how can I catch a field in a search operation, if possible, without writing a macro.

(sorry if t was not so clear)

My best suggestion would be to save your document as .fodt so that the XML is exposed. Then study how the Above/Below is encoded. Look also at the page reference encoding. I think both of them are some kind of attribute inside the < … > XML directive like xxx:ref_type=yyy (tagging not guarantedd, I had no look to it). If this is the case, replacing “yyy” is straightforward.

Many text editors have regexp features. Of course, the match part of the regexp should include "on page " so that you don’t replace a legitimate page number reference. Removing "on page " is elementary.