[^=]+$ 这个正则该怎么理解?

2020-06-04 23:43:39 +08:00
 GromHellscream
我的理解是这样:
1. $ 表示从输入的结尾开始匹配
2. + 表示前面匹配的项可以出现一次或多次
3. [^=] 表示匹配所有非 = 的内容

请问大家,我这样的理解对吗?谢谢
1848 次点击
所在节点    正则表达式
8 条回复
vibbow
2020-06-04 23:47:32 +08:00
[^=]+$
------

[^=]+$

Options: Case sensitive; Exact spacing; Dot doesn’t match line breaks; ^$ don’t match at line breaks; Greedy quantifiers; Regex syntax only

* [Match any character that is NOT a “=”][1] `[^=]+`
* [Between one and unlimited times, as many times as possible, giving back as needed (greedy)][2] `+`
* [Assert position at the end of the string, or before the line break at the end of the string, if any (line feed)][3] `$`

Created with [RegexBuddy]( https://www.regexbuddy.com/)

[1]: https://www.regular-expressions.info/characters.html
[2]: https://www.regular-expressions.info/repeat.html
[3]: https://www.regular-expressions.info/anchors.html
vibbow
2020-06-04 23:47:53 +08:00
说好的可以贴 MD 格式呢。。。
vibbow
2020-06-04 23:48:46 +08:00
GromHellscream
2020-06-05 00:01:22 +08:00
@vibbow 谢谢老哥,这软件真好,可惜 win 限定。
那根据这内容,我的理解是对的喽?
GromHellscream
2020-06-05 00:05:34 +08:00
@vibbow 再次感谢,这 regular-expressions.info 网站真好,谢谢
ulala
2020-06-05 05:22:30 +08:00
@GromHellscream 就是匹配开头不是等号的非空行。
ulala
2020-06-05 05:28:56 +08:00
哦,不对,是不以等号结尾的非空行,匹配该后缀
jxie0755
2020-06-05 07:37:56 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/678759

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX