This commit is contained in:
Miloslav Ciz 2024-03-10 17:17:47 +01:00
parent 66fe12a69c
commit 136d0905dd
9 changed files with 1697 additions and 1694 deletions

View file

@ -201,7 +201,7 @@ int main(void)
}
```
Just compile this and pass a string to the standard input (e.g. `echo "<testing> string | ./program"`), it will write out if it matches or not.
Just compile this and pass a string to the standard input (e.g. `echo "<testing> string" | ./program`), it will write out if it matches or not.
Maybe it seems a bit overcomplicated -- you could say you could program the above even without regular expressions and state machines. That's true, however imagine dealing with a more complex regex, one that matches a quite complex real world file format. Consider that in [HTML](html.md) for example there are pair tags, non-pair tags, attributes inside tags, entities, comments and many more things, so here you'd have great difficulties creating such parser intuitively -- the approach we have shown can be completely automatized and will work as long as you can describe the format with regular expression.