align-regexp

This interactive Emacs Lisp function was very handy for me during some log files analysis.

You mark region, invoke function, provide regexp and voila – your region is aligned.

Example data from align-regexp help:

Fred (123) 456-7890
Alice (123) 456-7890
Mary-Anne (123) 456-7890
Joe (123) 456-7890

Let’s say we want to align region on “(” character. For that we mark region we want to align and invoke function with: M-x align-regexp RET ( RET
Result of such invocation will be:

Fred      (123) 456-7890
Alice     (123) 456-7890
Mary-Anne (123) 456-7890
Joe       (123) 456-7890

One Response to “align-regexp”

  1. Emacs: align perl hash with align-current « Lazy Programmer Says:

    [...] reading Ruslan’s align-regexp, I find align-current and bind it to C-c C-c in cperl-mode. (define-key cperl-mode-map “C-cC-c” [...]

Leave a Reply