regex - 正则表达式从一个字符开始获取两个字符之间的所有内容
问题描述
解决方案
In
re'\gfby by A »;ŸÎ \ l o l l i . p o p - c o l \ n t u s e r . d a t dŸŸœ~®ã€º &¹UÚÂdŸŸœ~®ã€º &¹UÚ eŸŸœ~®ã€º &¹UÚÂrmtmÖpïJÔ
this
(?:(?! )[^\\.-])+\.(?:(?! )[^\\.-])+
finds
l o l l i .
p o p
and
n t u s e r . d a t
Breakdown:
(?: # begin non-capturing group (?! ) # look-ahead: any position not followed by two spaces [^\\.-] # any character except '\', '.', and `-` )+ # end group, repeat at least once \. # a '.' (?: # \ (?! ) # |-- exactly the same as above [^\\.-] # | )+ # /
- Use
*
instead of+
if you want to allow matches that start or end with a dot. - Single spaces are valid parts of the match, so they might occur at the start or end with this (in the above sample, they do). Trim the result if needed.
- Since the matching is done by a negated character class, we get the side conditions "...or the start/end of the string" and "include newlines" for free.
推荐阅读
- database - Spark MapWithState 管理会话状态
- java - android opencv 3.4.1 构建命令失败。未定义的引用
- c++ - 功能在特定时间内消耗墙壁时间
- c# - WPF组合框不以双向更新
- python-3.x - 网页抓取:迭代网站的页面,而无需使用 Python 和请求编辑 url
- python - Choropleth 地图没有为国家着色?
- python - 使用 QComboBox 选择显示的不同小部件集
- javascript - 将 div 彼此相邻对齐 CSS(卡片样式)
- mysql - MySQL 错误与 CREATE TABLE
- javascript - 下拉货币选择器