regular expressions – set theory with RegEx on fen strings (or another parser)

how can you find if a regex call is a subset of another regex call on an predictable set of data

I have a string (chess Forsyth–Edwards Notation (FEN) stringrnbqkbnr/pppp1ppp/8/4p3/3P4/8/PPP1PPPP/RNBQKBNR w KQkq e6 0 2)

If I use
/(.)/g it matches the super set of any possible chess position, i.e. /(r/)/g matches r/ , a sub set of /(.)/g

is it possible to apply set theory to regex (or another parser) on stings that follow a pattern like FEN? if so, how can I calculate if one regex is a subset, superset, or equal set of another for this data type?

my goal is to find if a parsing function will find a subset of the possible fen positions that another function will find.
is it possible to do this without mapping every possible fen string? that’s not an option.
should I use regex? or a different parsing system because the characters follow a pattern already?

Read more here: Source link