理解emacs align regexp
我已经阅读了align regexp的emacs文档,但仍然难以理解它是如何工作的。我所说的是它的前缀形式C-u m-x align regexp,而不是简单的形式m-x align regexp。我的问题是: 正则表达式的第一个参数必须匹配整行字符串吗?如果正则表达式只匹配字符串的一部分呢? 为第二个参数圆括号组提供什么,以便在为负时修改“对齐”?正如我在这里所理解的,我需要从1中提供一个捕获的组数计数,对吗?如果是否定的话,那么是否需要证明,如果我想让第3组右对齐,我会提供-3作为输入? 如果为负,则间距或列的第三个参数量意味着什么?我完全不明白这个参数的作用。 我收集了一些文本示例进行练习。如果有人可以使用下面的文字作为例子,这将是非常有帮助的 从 到理解emacs align regexp,regex,emacs,alignment,text-alignment,Regex,Emacs,Alignment,Text Alignment,我已经阅读了align regexp的emacs文档,但仍然难以理解它是如何工作的。我所说的是它的前缀形式C-u m-x align regexp,而不是简单的形式m-x align regexp。我的问题是: 正则表达式的第一个参数必须匹配整行字符串吗?如果正则表达式只匹配字符串的一部分呢? 为第二个参数圆括号组提供什么,以便在为负时修改“对齐”?正如我在这里所理解的,我需要从1中提供一个捕获的组数计数,对吗?如果是否定的话,那么是否需要证明,如果我想让第3组右对齐,我会提供-3作为输入? 如
对于第一种情况,请选择创建表下面的区域,然后尝试C-uM-xalign-regexp\:\-1 y 对于第二种情况,请选择区域并尝试C-uM-xalign-regexp\[0-9]+\-1 y 如您所见,正则表达式不必匹配整个字符串。您对第二个参数的理解似乎是正确的。有关详细信息,请阅读“对齐规则帮助”列表:
您在\::上缺少一个反斜杠。而且,这并不能真正回答问题。重复
class CreateStudents < ActiveRecord::Migration
def change
create_table :students, :comment => "学生信息表" do |t|
t.string :political_status, :comment => "政治面貌"
t.string :education_level, :comment => "培养层次"
t.string :enroll_method, :comment => "入学方式"
t.date :enrolled_at, :comment => "入学时间"
t.string :charge_type, :comment => "收费类别"
t.string :enrolled_year, :comment => "学籍年度"
t.string :enrolled_place, :comment => "生源所在地"
t.string :bank_card_number, :comment => "银行卡号"
t.string :bank_account_number, :comment => "银行账号"
t.boolean :is_active_duty, :default => false, :comment => "是否现役军人"
t.boolean :is_equivalent_degree, :default => false, :comment => "是否同等学历"
t.boolean :is_on_record, :default => true, :comment => "是否在籍"
t.boolean :is_at_school, :default => true, :comment => "是否在校"
t.timestamps
end
end
end
class CreateStudents < ActiveRecord::Migration
def change
create_table :students, :comment => "学生信息表" do |t|
t.string :political_status, :comment => "政治面貌"
t.string :education_level, :comment => "培养层次"
t.string :enroll_method, :comment => "入学方式"
t.date :enrolled_at, :comment => "入学时间"
t.string :charge_type, :comment => "收费类别"
t.string :enrolled_year, :comment => "学籍年度"
t.string :enrolled_place, :comment => "生源所在地"
t.string :bank_card_number, :comment => "银行卡号"
t.string :bank_account_number, :comment => "银行账号"
t.boolean :is_active_duty, :default => false, :comment => "是否现役军人"
t.boolean :is_equivalent_degree, :default => false, :comment => "是否同等学历"
t.boolean :is_on_record, :default => true, :comment => "是否在籍"
t.boolean :is_at_school, :default => true, :comment => "是否在校"
t.timestamps
end
end
end
my @primes = (
1,2,3,5,7,
11,13,17,19,23,
29,31,37,41,43,
);
my @primes = (
1, 2, 3, 5, 7,
11, 13, 17, 19, 23,
29, 31, 37, 41, 43,
);
`column' For alignment rules, if the `column' attribute is set --
which must be an integer, or a symbol whose value is an
integer -- it will be used as the column in which to align
the alignment character. If the text on a particular line
happens to overrun that column, a single space character,
or tab stop (see `align-to-tab-stop') will be added
between the last text character and the alignment
character.
`spacing' Alignment rules may also override the amount of spacing
that would normally be used by providing a `spacing'
attribute. This must be an integer, or a list of integers
corresponding to the number of parenthesis groups matched
by the `group' attribute. If a list of value is used, and
any of those values is nil, `align-default-spacing' will
be used for that subgroup. See `align-default-spacing'
for more details on spacing, tab stops, and how to
indicate how much spacing should be used. If TAB-STOP is
present, it will override the value of `align-to-tab-stop'
for that rule.