我正在使用记事本++,我想做一个查找和替换操作。
例如
在我的文件中,所有空格都在每一行的开头。
我应该使用什么正则表达式来查找确切的空格数?
我想用制表符替换空格(如基于 4 个空格或 6 个空格的单或双制表符)
注意:该文件是一个分类文件,其中说明 4 个空格是父级,6 个空格是子级,8 个空格是子级的子级。
文件示例:
Agriculture, forestry and fishing
Crop and animal production, hunting and related service activities
Growing of non perennial crops
Growing of cereals (except rice), leguminous crops and oil seeds
Growing of rice
Growing of vegetables and melons, roots and tubers
Run Code Online (Sandbox Code Playgroud)
正则表达式找出行首空格数的语法是
^(space_character){number_of_spaces_to_be_found}. ^ {4}. “\t”用一个标签替换你的发现。
"\t\t".
| 归档时间: |
|
| 查看次数: |
13875 次 |
| 最近记录: |