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 '*
'
精彩评论