我已经阅读了Emacs文档,align-regexp
但是仍然很难理解它是如何工作的。我要说的是它的前缀形式C-uM-xalign-regexp
,而不是简单形式M-xalign-regexp
。这是我的问题:
- 第一个参数(正则表达式)是否必须与字符串的整个行匹配?如果正则表达式仅匹配字符串的一部分怎么办?
- 向第二个参数提供什么(要修改的括号组(如果为负,则进行调整))?据我了解,我需要提供捕获的组号(从1开始计数),对吗?“如果否定则为正”是指,如果我希望第3组正确对齐,我将提供
-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,
);