Remove parentheses from constraints such as number(blank: false)
to number blank: false
:
- Search:
(\w+)\(([^)]+)\)$
- Replace:
\1 \2
Replace all method calls of the form foo('bar', 5)
to foo 'bar', 5
:
- Search:
^([ \t]*[\w.]+)\(([^])]+)\)$
- Replace:
\1 \2
In Vim use this command: :%s/\(\w\+\)(\([^])]\+\))$/\1 \2/gc
.
It doesn't replace occurrences such as foo([1, 2, 5])
because the replacement foo [1, 2, 5]
would be interpreted as property access.