开发者

Emacs align-regexp working with "="

Example code:

f x
  | "s" == x = 1
  | otherwise = 0

I can see the regex开发者_高级运维p as "match the equals sign when surrounded by whitespace characters". However, \s-+=\s-+ doesn't work (\s-+ is the pattern for 1+ whitespace) because it ends up inserting an extra space before the equals sign. I need a pattern that says "match empty string when there is whitespace here", but not sure how to do this?


This works for me:

C-u M-x align-regexp RET \(\s-+\)=\s- RET RET RET n

Note the '+' inside the parens, the default has '*'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜