- Select the whole document (
Ctrl + E
, or triple click in the left side). - Hit
Alt + F9
, to turn every reference into its respective code.
E.g., This cross reference, [1], after hitting Alt + F9
goes { REF _Ref88888888 \n or something }
- Open the Find and Replace dialog.
- Click in More and mark the Use wildcards checkbox so we can use
*
,?
,{}
,&
and so on. - Write this in the Find box:
REF *{19}
This will look for the appeareance of the expression REF
followed by 19 characters (change this at your convenience). In my current case, it will match all the expressions like REF _Ref35723036 \h \r
.
- In the Replace box, write this:
^&^92^116
^&
holds all the value that is referred in the "Find" box. E.g., if REF *{19}
finds "REF _Ref35723036 \h \n", ^&
will hold that value. ^92^116
is the "\t
" flag written with ASCII codes, each code preceded by a "^
", since I needed to add a special character to every cross reference so it would remove a space inside them, but you can write regular characters in the replace.
- Hit
Replace
orReplace all
depending on your needs and you'll update every cross-reference automatically. - Close the Find and Replace dialog, select all the document again and hit
Alt + F9
to turn every reference into regular text again. - With all the text selected, hit
F9
to refresh every cross reference so you can see the changes.
(Start at point 5 of the previous tutorial)
- Enclose the part you want to delete or crop out in the expression using brackets. In my example, I want to delete the flags of every cross reference (the
\n \h \t
part), so I'll change the expression I used before to:
REF (*{12})(*{6})
Doing this, I will enclose the first 12 characters of a reference in a group, which I'll be able to access using \1
, and the last 6 characters in a group I'll be able to access with \2
.
- In the Replace box write:
REF \1
This way I'm replacing every cross reference with themselves but cropping out those last six characters (since I'm leaving out the \2
group). If I had done the replacement with REF \1\2
, every reference would have stayed unchanged.
- Hit
Replace
orReplace all
depending on your needs and you'll update every cross-reference automatically.