rx
Regexp pattern matching for file system objects (eg
.*\\.txt
)
Returns a list of files and directories that match a regexp pattern.
Output is a JSON list.
rx pattern -> <stdout>
!rx pattern -> <stdout>
<stdin> -> rx pattern -> <stdout>
<stdin> -> !rx pattern -> <stdout>
cat: @{ rx '.*\.txt' }
rx '.*\.go' |> filelist.txt
if { rx somefiles.* } then {
# files exist
}
!if { rx somefiles.* } then {
# files do not exist
}
!rx '\.txt$'
Filtering a file list, returning only files that match the regexp match:
f +f -> rx '.*\.txt'
Please note that rx
here is doing an additional check if
the file exists.
f +f -> !rx '.*\.txt'
Unlike globbing (g
) which can traverse directories (eg
g /path/*
), rx
is only designed to match file
system objects in the current working directory.
rx
uses Go (lang)’s standard regexp engine.
If you want to exclude any matches based on wildcards, rather than include them, then you can use the bang prefix. eg
» rx READ*
[
"README.html"
]
murex-dev» !rx .*
Error in `!rx` (1,1): No data returned.
!rx
first looks for files that match its pattern, then
it reads the file list from stdin. If stdin contains contents that are
not files then !rx
might not handle those list items
correctly. This shouldn’t be an issue with rx
in its normal
mode because it is only looking for matches however when used as
!rx
any items that are not files will leak through.
This is its designed feature and not a bug. If you wish to remove
anything that also isn’t a file then you should first pipe into either
g *
, rx .*
, or f +f
and then pipe
that into !rx
.
The reason for this behavior is to separate this from
!regexp
and !match
.
rx
!rx
f
:
Lists or filters file system objects (eg files)g
: Glob
pattern matching for file system objects (eg *.txt
)regexp
: Regexp tools for arrays / lists of stringsmatch
:
Match an exact value in an arrayThis document was generated from builtins/core/io/rx_doc.yaml.
This site's content is rebuilt automatically from murex's source code after each merge to the master
branch. Downloadable murex binaries are also built with the website.
Last built on Sat Aug 23 22:28:13 UTC 2025 against commit ad23f13ad23f131bfecd82ea8a12d9b3e92aab5d8398ae9.
Current version is 7.0.2129 (website) which has been verified against tests cases.