【发布时间】:2018-01-31 21:58:38
【问题描述】:
我正在寻求帮助,以允许我的用户缩小某些文本输出的格式,以满足他们的偏好。
例子:
User list Summary:
Title:
- Big Pink
Student:
- Philip J Fry
Grade:
- A
Issues:
- This issue
- That issue
Improvements:
- This thing
- That thing
- The other thing
我希望能够将单个答案缩短为一行,但不考虑多行答案。这样上面就变成了:
User list Summary:
Title: Big Pink
Student: Philip J Fry
Grade: A
Issues:
- This issue
- That issue
Improvements:
- This thing
- That thing
- The other thing
我已经走到这一步了:https://jsfiddle.net/hematogones/0d4g0akh/
感谢您的帮助!
【问题讨论】:
-
您熟悉 regex101.com 的强大实用程序吗?
-
所以
Improvements: this thing只有 1 个-this thing? -
@Pytth 谢谢 - 我不知道那个网站。我一直在尝试,它确实是学习正则表达式的好资源。我一直在使用 Regexr,但是 Regex101 有更详细的解释。
标签: javascript regex match