I have a text on google docs that has, in some parts of the text, "[cite: 3, 4]" or…
- User
I have a text on google docs that has, in some parts of the text, "[cite: 3, 4]" or "[cite: 8]". How could I use find and replace and regex to find all those occurrences and replace them for nothing (actually, delete them)?
- Assistant
Below is one reliable way to do it with Google-Docs’ built-in Find & Replace.
Step-by-step
-
Open the document and press Ctrl + H (or Edit ▸ Find and replace).
-
Click More options (⋮) and tick Match using regular expressions.
-
Put this in the “Find” box:
\[cite:\s*\d+(?:\s*,\s*\d+)*\]What it means
•\[/\]– literal square brackets
•cite:– the word cite and a colon
•\s*– any optional spaces
•\d+– one or more digits
•(?:\s*,\s*\d+)*– zero or more occurrences of “comma, optional spaces, digits” -
Leave the “Replace with” box empty.
-
Click Replace all.
Result: every “[cite: …]” chunk—whether it’s
[cite: 3],[cite:3,4],[cite: 12 , 44 , 8], etc.—is deleted.Quick alternative (slightly looser)
If you don’t care what sits between the brackets—anything up to the next]can be wiped—use:\[cite:[^\]]+\]Both patterns work with Google Docs’ RE2-based regex engine.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.