我已阅读align-regexp
的emacs文档,但仍难以理解其工作原理。我所说的是它的前缀形式 C-u M-x align-regexp ,而不是简单形式 M-x align-regexp 。我的问题是:
-3
作为输入吗?我收集了一些文字示例来练习。如果有人可以使用下面的文字作为非常有帮助的例子。
发件人
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,
);
答案 0 :(得分:0)
对于第一种情况,请选择区域(create table
下方)并尝试 Cu Mx align-regexp
\(:\)
{{ 1}} -1
1
。
对于第二种情况,选择区域并尝试 Cu Mx y
align-regexp
\([0-9]+\)
-1
{ {1}}。
如您所见,正则表达式不必匹配整个字符串。您对第二个参数的理解似乎是正确的。有关详细信息,请阅读1
的帮助:
y