Rebol Parsing Rule:如何更正规则以分隔段落
我想解析下面的订单系列:
orders-series: {Wordpress Profiles
Blogger is a User
Admin is a Blogger
Author is a Blogger
Subscriber is a User
Blogger Role
Blogger Manage Posts
Admin Roles
Admin Manage Site
Manage Site Include Manage Users
Manage Site Include Manage Themes
Manage Site Include Manage Plugins
}
orders-block: copy []
newline2: rejoin [newline newline]
rule: [
[some [copy orders to newline2 (append orders-block orders) thru newline2]]
| copy orders to end (append orders-block orders)
]
parse orders-series rule
write clipboard:// mold orders-block
我在剪贴板中得到了这个
[{Wordpress Profiles
Blogger is a User
Admin is a Blogger
Author is a Blogger
Subscriber is a User} "Blogger Role^/Blogger Manage Posts"]
,而我想得到这个
[{
Wordpress Profiles
Blogger is a User
Admin is a Blogger
Author is a Blogger
Subscriber is a User
}
{
Blogger Role
Blogger Manage Posts
}
{
Admin Roles
Admin Manage Site
Manage Site Include Manage Users
Manage Site Include Manage Themes
Manage Site Include Manage Plugins
}]
我应该如何修改我的解析规则?
谢谢。
I want to parse orders-series below:
orders-series: {Wordpress Profiles
Blogger is a User
Admin is a Blogger
Author is a Blogger
Subscriber is a User
Blogger Role
Blogger Manage Posts
Admin Roles
Admin Manage Site
Manage Site Include Manage Users
Manage Site Include Manage Themes
Manage Site Include Manage Plugins
}
orders-block: copy []
newline2: rejoin [newline newline]
rule: [
[some [copy orders to newline2 (append orders-block orders) thru newline2]]
| copy orders to end (append orders-block orders)
]
parse orders-series rule
write clipboard:// mold orders-block
I got this in clipboard
[{Wordpress Profiles
Blogger is a User
Admin is a Blogger
Author is a Blogger
Subscriber is a User} "Blogger Role^/Blogger Manage Posts"]
whereas I would like to get this
[{
Wordpress Profiles
Blogger is a User
Admin is a Blogger
Author is a Blogger
Subscriber is a User
}
{
Blogger Role
Blogger Manage Posts
}
{
Admin Roles
Admin Manage Site
Manage Site Include Manage Users
Manage Site Include Manage Themes
Manage Site Include Manage Plugins
}]
How should I modify my parse rule ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我使用稍微不同的方法:
我怀疑 Doc 和 Henrik 的解决方案都会因 Blogger 管理帖子和管理员角色之间的额外空行而出错。
I use a slightly different approach:
I suspect that both Doc's and Henrik's solution would be tripped up by the additional blank line between Blogger Manage Posts and Admin Roles.
我认为这也有效:
I think this works too:
只需删除 |前面: |复制...
Just remove the | in front of: | copy...