Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is there a document that describes these? I've seen them mentioned before as one of the superpowers of Sam, but I've never seen a clear explanation of them for someone who isn't already a Sam user. I have no real intention of ever using or trying Sam as my daily text editor for a handful of reasons, but I am interested in new paradigms and tools for working with code.


http://doc.cat-v.org/plan_9/4th_edition/papers/sam/

look for the section on structural expressions.

I am not really an expert but my understanding is that they are called that because you can use them to define the structure of a match. in most regular expression engines the structure is defined as a line of text or the whole document and the expression only matches the contents. This is why they do so well with multi line records you just need to define a structure expression that matches your, well.. structure.

I never did learn sam all that well, I mainly used it as a non interactive sed replacement. however I just learned that apparently the vis project uses structural expressions. I might try it. Mainly because at least then my fingers sort of know what to do.





Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: