30 lines
1.3 KiB
Plaintext
30 lines
1.3 KiB
Plaintext
Regular Expression Hacks
|
|
========================
|
|
These scripts explore regular expressions in the formal sense---those that
|
|
represent precisely the types of languages that can be decided by a finite
|
|
state machine (Type-3 grammars in the Chomsky hierarchy). This differs from
|
|
the types of regular expressions typically found in text editors and
|
|
programming languages, which are far more expressive.[0]
|
|
|
|
I expect eventually to go into what makes this so interesting, but for the
|
|
time being, know that these examples _can_ be solved more simply using
|
|
features of modern regex engines. Sed, for example, does support
|
|
backreferences, which would have made certain examples here trivial to
|
|
implement. But then they wouldn't have very much hack value, would they?
|
|
|
|
As such, these scripts are intentionally esoteric. They are not things you
|
|
should probably use in a production system.
|
|
|
|
To run the, use the `animate' script. If the sed script being run does not
|
|
produce fixed-width frames, use the `-c' option. Example inputs and
|
|
commands can be found in many of the scripts.
|
|
|
|
|
|
[0]: https://en.wikipedia.org/wiki/Regular_expression
|
|
|
|
|
|
Copyright (C) 2018 Mike Gerwitz
|
|
|
|
This file is released under the Creative Commons Attribution-ShareAlike 4.0
|
|
International License. See COPYING.CCBYSA for more information.
|