Using Dotstar · Part 2
Understanding a pattern
A pattern of any length is hard to read, even one you wrote last month. The Explain tab, the first in the side panel, takes it apart and says what each part does, in plain English.
The tree
Each row is a part of the pattern, in order, with the parts inside a group or a lookaround indented under it. Hover a row and its part lights up in the pattern; click it to select that part, ready to change. The arrows fold a branch away.

You can also rearrange a pattern there: drag a row to move its part (hold ⌥ to copy it instead), and the pattern changes with it.
The replacement, when Replace is on, is explained too: each group it puts in, and what’s plain text.
The diagram
Diagram, at the top of the tab, draws the pattern as a railroad diagram. Read the tracks from left to right:
- where they split, any one of the branches will do
- a loop back under a part repeats it, dashed when it’s lazy
- a track around a part may skip it
- a frame is a group or a lookaround, with its name or number

Point at a part to see it in the pattern and what it means; click it to select it. A long pattern goes on in rows to fit; − and + zoom it, and Open larger shows it over the whole window, where Save as SVG… makes an image of it, for documentation or a code review.
Writing a pattern
Two things help while you write:
- Insert, after the flags (⌘I, or right-click in the pattern), puts a token in from a menu, so you don’t need to remember the syntax. One that needs something from you, as a number of times or a group’s name, asks for it first.
- Suggestions come up after
\,(or[: the syntax your flavor has from there, each with what it means. ↑ and ↓ choose, Enter or Tab puts one in. ⌃Space shows them anywhere, and after a word searches what they mean: typeboundaryand press ⌃Space.
Pasting code with a pattern in it, like re.compile(r'\d+', re.I) or new Regex(@"\d+"), offers the pattern alone, read with that language’s string rules and with its flags.