正则表达式和非技术用户
鉴于:
- 您有一些可以修改的键值数据,
- 修改是通过对数据应用过滤器来完成的。控制更改内容的过滤器是由非技术人员创建的。
- 过滤器是使用正则表达式设置的。描述为过滤器一部分的规则的示例可能是“如果键与某些正则表达式匹配,则将值替换为其他值”
您会如何:
如果过滤器由业务人员生成,他们会无法创建正则表达式,您会让他们以什么形式提交可以轻松转换为正则表达式的输入?
Given that:
- You have some Key-Value data that can be modified
- Modification is done via by applying filters to the data. Filters that control what gets changed are created by non-technical people
- The filters are setup using regular expressions. An example of a rule described as part of a filter may be "If a key matches some regex, replace value with some other value"
How would you:
If filters are to be produced by business people, who can't create regular expressions, in what form would you have them submit their input that would be easily translated to regex?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Agent Ransack 包含一个 GUI 编辑器,用于从简单的英语创建正则表达式,我建议您看一下并实现您自己的变体。
请参阅示例屏幕截图:
Agent Ransack contains a GUI editor for creating regular expressions from plain English, I would suggest taking a look at that and implementing your own variation of it.
See the screenshot for an example:
如果它有效,我会选择“仅通配符”支持 - 即星号
*
是唯一允许的特殊字符,您可以将其转换为代码中的正则表达式.*?
。大多数非技术人员都可以理解
*
的意思是“任何东西”。If it works, I would go for "wildcard only" support - ie the asterisk
*
is the only special character allowed and you translate that to the regex.*?
in code.Most non-technical people can grasp
*
meaning "anything".