4 ms·
An "sexp machine" is fairly simple. And yes, you can use regexs on s-expressions in exactly the same way that you'd use them on xml/html/markup. And you'd run
by anamax 17y ago
An "sexp machine" is fairly simple.
And yes, you can use regexs on s-expressions in exactly the same way that you'd use them on xml/html/markup. And you'd run into the same errors.
Note that reading s-expressions and extracting things from the result is significantly easier and faster than using regexs.... (The same is true of xml.)
Regular expressions are a great hammer, but many things are not nails.
- mojuba 17y agoWith XML or any markup you can ignore the hierarchy and easily strip out everything that's not text, while with Sexp's I'm afraid you can't. In order to extract raw text (or actually strings) from SXML you'd need to read and understand the tree structure, which is not possible with a single-regex run.
- anamax 17y agoOh really? How do you know that the sequence of bytes http://foo.bar.com/a/c http://foo.bar.com/a/c is text or an attribute value with a regexp? How about foo.bar? How about Times Roman or 16px? How about the four bytes html ?