![](/img/trans.png)
[英]Regex Pattern Matching: Using only the start and end of a pattern for matching
[英]Matching pattern to end of line
我正在尝试从文本文件中获取一些行内注释,并且需要一些有关表达式的帮助。
this comes before selection
this is on the same line %% this is the first group and it can have any character /[{3$5!+-p
here is some more text in the middle
this stuff is also on a line with a comment %% this is the second group of stuff !@#%^()<>/~`
this goes after the selections
我正在尝试获取%% \\ s +之后的所有内容。 这是我尝试过的:
%% \\ s +(。*)$
但这与第一个%%之后的所有文本匹配。 不知道从这里去哪里。
大多数引擎默认为点与换行符不匹配
AND不是多行模式。
这意味着%%\\s+(.*)$
不匹配,除非找到
字符串最后一行的%%
。
与其尝试对抗,不如使用内联修饰符(?..)
覆盖外部开关。
使用(?-s)%%\\s+(.*)
其起飞点的所有
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.