如何指示通配符的存在而不在搜索字符串本身中指定通配符?
关于使用 XML,指示搜索字符串中存在通配符(星号和问号)而不在字符串本身中指定通配符的最有效和/或优雅的方式是什么?
例如,这是无效的:
<searchString>
<searchFor>*cat??</searchFor>
</searchString>
这是有效的:
<searchString>
<searchFor>cat</searchFor>
<wildcards>
<asterisk>
<offset>0</offset>
</asterisk>
<questionMark>
<offset>3</offset>
<count>2</count>
</questionMark>
</wildcards>
</searchString>
请注意,上面的有效示例还存在一个问题,即无法指定搜索字符串 *??cat
其中有两种不同类型的通配符以相同的偏移值发生。这也必须得到照顾。
With regards to using XML, what is the most efficient and/or elegant way of indicating the presence of wildcards (Asterisk and Question Mark) in a search string without specifying it in the string itself?
For example, this is invalid:
<searchString>
<searchFor>*cat??</searchFor>
</searchString>
and this is valid:
<searchString>
<searchFor>cat</searchFor>
<wildcards>
<asterisk>
<offset>0</offset>
</asterisk>
<questionMark>
<offset>3</offset>
<count>2</count>
</questionMark>
</wildcards>
</searchString>
Note that there is also a problem with the valid example above which is unable to specify the search string *??cat
where two different types of wildcard characters occur with the same offset value. This must be taken care of as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用:
解决最后一个问题,并且在需要时可以轻松转换为完整的查询字符串。
You could use:
which resolves the final problem, and would be simple to transform to the full query string when you need it.