Softanza
StartFrançais
Softanza
A paradigm

Pattern languages

One regex-shaped grammar, across seven kinds of data: strings, lists, numbers, time, tables, matrices and graphs, in one library, with one habit.

One grammar, seven subjects

Regular expressions were redesigned first, as a class, a pattern builder and a data library. Their grammar, braces and the at sign, was then lifted to six more kinds of data, each a class with its own small function. The same habit holds in all seven: write the pattern, ask Match, and ask the pattern to explain itself.

  1. Strings. rx(pat(:email)) the regular expression, backed by a standard engine
  2. Lists. [@N1-3, @S], and stepped ranges, and nested lists Lx()
  3. Numbers. {@Property(Even) & @Property(Prime)} Nx()
  4. Time. {@Event(Meeting) -> @Duration(30m) -> @Event(Break)} Tmx()
  5. Tables. {cols(3) & unique(id) & avgcol(salary:>40000)} Tx()
  6. Matrices. {shape(square) & property(symmetric)} Mx()
  7. Graphs. {@Node(start) -> @Edge(flows) -> @Node(done)} Gx()

The patterns in this list are written, not run. The runs below are the ones that kept their promise.

Over a string: the pattern finds every run of digits, and counts them.

Softanza
o = Rgx("\d+")
o.MatchFirst("a1b22c333")
? @@( o.AllMatches() )
? o.NumberOfMatches()
Output
[ "1", "22", "333" ]
3

run on 2026-10-09 02:11 inside the library at commit 4a184e6f0; taken from base/test/regex/00_regex_narrated.ring(opens in a new tab)

Over a list: two or three unique numbers from a set match; a number then a string does not match a list that opens with a string.

Softanza
oLx = new stzListex("[@N2-3{1; 2; 3}U]")
? oLx.Match([ 1, 2 ])
oLy = new stzListex("[@N, @S]")
? oLy.Match([ "hello", 1 ])
Output
1
0

run on 2026-10-09 02:11 inside the library at commit 4a184e6f0; taken from base/test/listex/01_listex_-_enhanced_test_suite.ring(opens in a new tab)

Over a number: a property is the pattern, here being prime.

Softanza
Nx = new stzNumbrex("{@Property(Prime)}")
? Nx.Match(17)
? Nx.Match(18)
Output
1
0

run on 2026-10-09 02:11 inside the library at commit 4a184e6f0; taken from base/test/numbrex/02_basic_property_matching.ring(opens in a new tab)

Over a matrix: a size is the pattern.

Softanza
oMx = new stzMatrex("{Size(3x3)}")
aMatrix = [
	[1, 2, 3],
	[4, 5, 6],
	[7, 8, 9]
]
? oMx.Match(aMatrix)
Output
1

run on 2026-10-09 02:11 inside the library at commit 4a184e6f0; taken from base/test/matrex/01_matching_exact_size.ring(opens in a new tab)

Over a graph: a path of a node, an edge and a node is the pattern, matched without regard to case; a node that is not there does not match.

Softanza
g = new stzGraph("Mixed")
g.AddNodeXT(:a, "Start")
g.AddNodeXT(:b, "PROCESS")
g.AddNodeXT(:c, "end")
g.AddEdgeXT(:a, :b, "Flows")
g.AddEdgeXT(:b, :c, "COMPLETES")
gx = new stzGraphex("{@Node(start) -> @Edge(flows) -> @Node(process)}", g)
? gx.Match(g)
gy = new stzGraphex("{@Node(zzz)}", g)
? gy.Match(g)
Output
1
0

run on 2026-10-09 02:11 inside the library at commit 4a184e6f0; taken from base/test/graphex/00_graphex_narrated.ring(opens in a new tab)

What can be said of it

The library's articles compare it with the field: Wolfram has list patterns, uniqueness and stepped ranges; Elixir, Haskell and Rust match structures; graph query languages and complex-event languages exist. What the articles find in none of them is one regex-shaped grammar across seven kinds of data in one library, with the same small-function habit, the same Match, Explain and Debug surface, and the same test discipline. That is the library's own reading of the field, not a survey.

The honest state

in construction Two of the seven runs above are missing, and they are missing because they failed. The library's own tests for the table and the time patterns promise a match and print none at the commit read for this page. They are reported to the library, and the two languages are shown here without a run. Graph quantifiers are parsed and not yet used. The regex analyser is a name, and the siblings of the Regexuter are a vision.

Sources: the articles regex, lists, numbers, time, tables and matrices; the guards in the library's test folders for each, linked under every run.