m-ender / retina

A regex-based programming language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add stage for sorting

m-ender opened this issue · comments

I'm imagining it to work something like this:

  • The regex is matched against the string and "pulled out" of the string (but the slots they came from are remembered).
  • The matches are sorted and reinserted in sorted order into the slots they were taken from.

This way you could e.g. sort all lines with .+. It might make this very powerful if there was an optional substitution pattern such that the matches were sorted by the substitution pattern instead. Maybe it could also use an option to sort numerically, so that you can easily sort by length if the substitution pattern is $.&.

Implemented in 89a708e.