RegexQuery class

Regex/glob query: each segment is a compiled regex, with ** support for crossing hierarchy boundaries.

Segment syntax

The query string is split on / into segments. Each segment is independently compiled as a case-sensitive RegExp anchored to the full occurrence or signal name (^…$). This means:

  • Plain names match exactly: Top/CPU/clk.
  • Glob wildcards are auto-converted before compilation:
    • *.* (match any characters)
    • ?. (match one character)
    • These compose naturally: clk* matches clk, clk_gated, clk_div2, etc.
  • Full regex is supported within each segment since the string is passed to RegExp:
    • d[0-9]+ — signals named d0, d1, d12, …
    • (clk|reset) — either clk or reset
    • data_[a-z]{2}data_ab, data_xy, …
    • .*mux.* — any name containing mux
    • ch[0-3]ch0, ch1, ch2, ch3
    • r[0-9]{1,2}r0 through r99
  • ** (double-star, as its own segment) matches zero or more hierarchy levels, allowing searches to cross boundaries:
    • Top/**/clkclk at any depth below Top
    • **/d[0-9]+ — any signal like d0 anywhere
    • Top/**/ch*/data_*data_* signals inside ch* modules

Interaction between glob and regex

Glob conversion happens before regex compilation, so * and ? are always expanded. If you need a literal * or ? in the regex, escape them: \*, \?. All other regex metacharacters (., +, |, (, ), [, ], {, }, ^, $) work as-is inside each segment.

Examples

Query                     Matches
─────────────────────────────────────────────────────────────
Top/CPU/clk               exact: Top → CPU → clk
Top/CPU/*                 all signals in Top/CPU
Top/*/clk                 clk one level below Top
Top/**/clk                clk at any depth below Top
Top/**/c.*                signals starting with 'c' anywhere
**/clk                    clk anywhere in hierarchy
**/(clk|reset)            clk or reset anywhere
Top/CPU/d[0-9]+           d0, d1, d12, … in Top/CPU
Top/**/ch[0-3]/data_*     data_* in ch0–ch3 at any depth
Top/mem_*/addr[0-9]*      addr0, addr1, … in mem_* modules
**/.*mux.*                any name containing 'mux' anywhere
Inheritance

Constructors

RegexQuery(String rawQuery, {SearchTarget target = SearchTarget.signals})
Create a regex query from rawQuery.

Properties

crossesBoundaries bool
Whether this query can match across hierarchy boundaries.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Whether the query is empty / trivial (should return no results).
no setterinherited
rawQuery String
The original user-supplied query string.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
segmentCount int
Number of logical segments in the parsed query.
no setteroverride
segments List<RegexSegment>
Compiled segments — either a regex or a glob-star sentinel.
latefinal
target SearchTarget
What this query matches — occurrences, signals, or both.
finalinherited

Methods

isComplete(int stateIndex) bool
Whether the query is fully consumed at stateIndex.
override
matchOccurrence(String occurrenceName, int stateIndex) Set<int>
Try matching an occurrence name at match state stateIndex.
override
matchSignal(String signalName, int stateIndex) bool
Whether signalName matches the query at state stateIndex.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited