Mike Gerwitz

Free Software Hacker+Activist

aboutsummaryrefslogtreecommitdiffstats
blob: e639c49fd7367e615df79428f2125271c6b5fb86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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.