<html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><title>Search, replace and go to</title><linkrel="stylesheet"href="geany.css"type="text/css"><metaname="generator"content="DocBook XSL Stylesheets V1.72.0"><linkrel="start"href="index.html"title="Geany 0.11"><linkrel="up"href="ch03.html"title="Chapter3.Usage"><linkrel="prev"href="ch03s05.html"title="Editing"><linkrel="next"href="ch03s07.html"title="Tags"></head><bodybgcolor="white"text="black"link="#0000FF"vlink="#840084"alink="#0000FF"><divclass="navheader"><tablewidth="100%"summary="Navigation header"><tr><thcolspan="3"align="center">Search, replace and go to</th></tr><tr><tdwidth="20%"align="left"><aaccesskey="p"href="ch03s05.html">Prev</a></td><thwidth="60%"align="center">Chapter3.Usage</th><tdwidth="20%"align="right"><aaccesskey="n"href="ch03s07.html">Next</a></td></tr></table><hr></div><divclass="section"lang="en"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aname="search"></a>Search, replace and go to</h2></div></div></div><p>
This section describes search-related commands from the Search menu and
the editor window's popup menu:
</p><p>
</p><divclass="itemizedlist"><ultype="disc"><li><p>Find</p></li><li><p>Find usage *</p></li><li><p>Find in files</p></li><li><p>Replace</p></li><li><p>Go to tag definition *</p></li><li><p>Go to tag declaration *</p></li><li><p>Go to line</p></li></ul></div><p>
</p><p>
* These items are available from the editor window's popup menu, or by
using a keyboard shortcut (see <ahref="ch03s12.html"title="Keybindings">the section called “Keybindings”</a>).
Find usage searches all open files. It is similar to the
<spanclass="emphasis"><em>Find All In Session</em></span> Find dialog command.
</p><p>
If there is a selection, then it is used
as the search text; otherwise the current word is used.
The current word is either taken from the word nearest the edit cursor, or
the word underneath the popup menu click position when the popup menu is
used.
The search results are shown in the Messages tab of the Message Window.
</p></div><divclass="section"lang="en"><divclass="titlepage"><div><div><h3class="title"><aname="search_fif"></a>Find in files</h3></div></div></div><p>
Find in files is a more powerful version of Find usage that searches all files
in a certain directory using the Grep tool. The Grep tool must be correctly set
in Preferences to the path of the system's Grep utility.
GNU Grep is recommended.
</p><p>
</p><divclass="figure"><aname="id2810936"></a><pclass="title"><b>Figure3.2.Find in files dialog</b></p><divclass="figure-contents"><div><imgsrc="images/find_in_files_dialog.png"alt="Find in files dialog"></div></div></div><p><brclass="figure-break">
</p><p>
The <spanclass="emphasis"><em>Extra options</em></span> field is used to pass any additional
arguments to the <codeclass="literal">grep</code> tool.
</p><divclass="section"lang="en"><divclass="titlepage"><div><div><h4class="title"><aname="id2810965"></a>Filtering out version control files</h4></div></div></div><p>
When using the <spanclass="emphasis"><em>Recurse in subfolders</em></span> option with a
directory that's under version control, you can set the
<spanclass="emphasis"><em>Extra options</em></span> field to use <codeclass="literal">grep</code>'s
<codeclass="literal">--exclude</code> flag to filter out filenames.
<spanclass="emphasis"><em>Replace All In Document</em></span> will replace all matching text
in the current document.
<spanclass="emphasis"><em>Replace All In Session</em></span> does the same for all open documents.
<spanclass="emphasis"><em>Replace All In Selection</em></span> will replace all matching text
in the current selection of the current document.
</p></div></div><divclass="section"lang="en"><divclass="titlepage"><div><div><h3class="title"><aname="search_gototag"></a>Go to tag definition</h3></div></div></div><p>
If the current word is the name of a tag definition (like a function body)
and the file containing the tag definition is open, this command will
switch to that file and go to the corresponding line number.
The current word is either taken from the word nearest the edit cursor, or
the word underneath the popup menu click position when the popup menu is
used.
</p></div><divclass="section"lang="en"><divclass="titlepage"><div><div><h3class="title"><aname="id2811169"></a>Go to tag declaration</h3></div></div></div><p>
Like Go to tag definition, but for a forward declaration such as a
function prototype or <codeclass="literal">extern</code> declaration instead
of a function body.
</p></div><divclass="section"lang="en"><divclass="titlepage"><div><div><h3class="title"><aname="id2811187"></a>Go to line</h3></div></div></div><p>
Go to a particular line number in the current file.
In a regular expression, the following characters are interpreted:
</th></tr></thead><tbody><tr><td>.</td><td>Matches any character.</td></tr><tr><td>(</td><td>This marks the start of a region for tagging a match.</td></tr><tr><td>)</td><td>This marks the end of a tagged region.</td></tr><tr><td>\n</td><td>Where n is 1 through 9 refers to the first through ninth tagged region
when replacing. For example, if the search string was Fred([1-9])XXX
and the replace string was Sam\1YYY, when applied to Fred2XXX this would
generate Sam2YYY.
</td></tr><tr><td>\<</td><td>This matches the start of a word.</td></tr><tr><td>\></td><td>This matches the end of a word.</td></tr><tr><td>\x</td><td>This allows you to use a character x that would otherwise have a special
meaning. For example, \[ would be interpreted as [ and not as the start
of a character set. Use \\ for a literal backslash.
</td></tr><tr><td>[...]</td><td>This indicates a set of characters, for example, [abc] means any of the
characters a, b or c. You can also use ranges, for example [a-z] for any
lower case character.
</td></tr><tr><td>[^...]</td><td>The complement of the characters in the set. For example, [^A-Za-z] means
any character except an alphabetic character.
</td></tr><tr><td>^</td><td>This matches the start of a line (unless used inside a set, see above).</td></tr><tr><td>$</td><td>This matches the end of a line.</td></tr><tr><td>*</td><td>This matches 0 or more times. For example, Sa*m matches Sm, Sam, Saam, Saaam and so on.</td></tr><tr><td>+</td><td>This matches 1 or more times. For example, Sa+m matches Sam, Saam, Saaam and so on.</td></tr></tbody></table></div></div><p><brclass="table-break">