匹配线与可能的前面的空格 [英] Match lines with possible preceding whitespaces

查看:110
本文介绍了匹配线与可能的前面的空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Emacs中,我想使用正则表达式匹配诸如

 符号列表
符号列表
符号列表

并不匹配以数字开头的行或(零个或多个前面的空格)如

  1。算术和代数
1.算术和代数
(a)Powers
(a)Powers

但是 ^ * [^ [:digit:](] ^ [[:space:]] * [^ [:数字:](] 可以匹配

  1.算术和代数
(a)权力

每行开头有空格。



我想知道我错了什么?谢谢。

解决方案

你可以将它减少到匹配的行

:digit:](]


In Emacs, I want to use regex to match lines such as

List of symbols
 List of symbols
   List of symbols

and not match lines which begin with a digit or ( (with zero or more preceding white spaces) such as

1. Arithmetic and Algebra
 1. Arithmetic and Algebra
(a) Powers
 (a) Powers

But either ^ *[^[:digit:](] or ^[[:space:]]*[^[:digit:](] can match

 1. Arithmetic and Algebra
 (a) Powers

where there is a space at the beginning of each line.

I wonder where I am wrong? Thanks.

解决方案

You can probably reduce it to matching lines that don't start with a digit
or open parenthesis.

^[^[:digit:](]

这篇关于匹配线与可能的前面的空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆