I have some SQL code in the following style:
"CREATE TABLE IF NOT EXISTS test ( \n\
\ id INTEGER PRIMARY KEY, \n\
\ symbol TEXT NOT NULL, \n\
\ date TEXT NOT NULL, \n\
\ val DECIMAL(10, 2) NOT NULL, \n\
\"
I'd like the datatypes to be aligned. In other words:
"CREATE TABLE IF NOT EXISTS test ( \n\
\ id INTEGER PRIMARY KEY, \n\
\ symbol TEXT NOT NULL, \n\
\ date TEXT NOT NULL, \n\
\ val DECIMAL(10, 2) NOT NULL, \n\
\"
I thought using align-regexp
with the pattern [A-Z]+
would work, but it does not. Using C-u M-x align-regexp
with \(\s-*\)[A-Z]+
doesn't work either. Instead, it replaces the two spaces before the column names with a single space. I do not understand why this is.
So, my questions:
Why doesn't
align-regexp
with[A-Z]+
work? Searching based on the same pattern correctly identifies the text.What is the right regexp that would get this alignment?