[英]C# Regex.Split
I have a particular problem in complex string: 我在复杂的字符串中有一个特殊的问题:
string mode: 字符串模式:
Description,Title,ContentFooterLeft[JE_Boxes: Identifier,Box,Namespace,Title,Channels,PriorityChannels,ForceChannel,SingleQuery,Template,Elements[JE_Example: Lead],LastNews[JE_Article: Lead, Galeria [JE_Gallery: Title,Banner [JE_Banner: Title],],],],Keywords
Tree mode: 树模式:
Description,
Title,
ContentFooterLeft
[
JE_Boxes:
Identifier,
Box,
Namespace,
Title,
Channels,
PriorityChannels,
ForceChannel,
SingleQuery,
Template,
Elements
[
JE_Example:
Lead
],
LastNews
[
JE_Article:
Lead,
Galeria
[
JE_Gallery:
Title,
Banner
[
JE_Banner:
Title
],
],
],
],
Keywords
And my objective with Regex.Split its something like this: 我对Regex的目标是这样的:
1º [Step] Call function: 1º[Step]呼叫功能:
Regex.Split("Description,Title,ContentFooterLeft[JE_Boxes: Identifier,Box,Namespace,Title,Channels,PriorityChannels,ForceChannel,SingleQuery,Template,Elements[JE_Example: Lead],LastNews[JE_Article: Lead, Galeria [JE_Gallery: Title,Banner [JE_Banner: Title],],],],Keywords", "Regex expression")
1º Result: 1º结果:
Description
Title
ContentFooterLeft[JE_Boxes:Identifier,Box,Namespace,Title,Channels,PriorityChannels,ForceChannel,SingleQuery,Template,Elements[JE_Example: Lead],LastNews[JE_Article: Lead, Galeria [JE_Gallery: Title,Banner [JE_Banner: Title],],],]
Keywords
2º [Step] Call function: 2º[Step]呼叫功能:
Regex.Split("ContentFooterLeft[JE_Boxes:Identifier,Box,Namespace,Title,Channels,PriorityChannels,ForceChannel,SingleQuery,Template,Elements[JE_Example: Lead],LastNews[JE_Article: Lead, Galeria [JE_Gallery: Title,Banner [JE_Banner: Title],],],]", "Regex expression")
2º Result: 2º结果:
JE_Boxes
Identifier
Box
Namespace
Title
Channels
PriorityChannels
ForceChannel
SingleQuery
Template
Elements[JE_Example: Lead]
LastNews[JE_Article: Lead, Galeria [JE_Gallery: Title,Banner [JE_Banner: Title],],]
3º [Step] Call function: 3º[Step]呼叫功能:
Regex.Split("Elements[JE_Example: Lead]", "Regex expression")
Regex.Split("LastNews[JE_Article: Lead, Galeria [JE_Gallery: Title,Banner [JE_Banner: Title],],]", "Regex expression")
3º Result: 3º结果:
JE_Example
Lead
AND 和
JE_Article
Lead
Galeria [JE_Gallery: Title,Banner [JE_Banner: Title],]
4º [Step] Call function: 4º[Step]呼叫功能:
Regex.Split("Galeria [JE_Gallery: Title,Banner [JE_Banner: Title],]", "Regex expression")
4º Result: 4º结果:
JE_Gallery
Title
Banner [JE_Banner: Title]
5º [Step] Call function: 5º[Step]呼叫功能:
Regex.Split("Banner [JE_Banner: Title]", "Regex expression")
5º Result: 5º结果:
JE_Banner
Title
Obvious when i know the regular(s) expression(s) i will make this in a recursive method... Sorry for my long text, but this is the best way to present my problem... 很明显,当我知道正则表达式时,我将采用递归方法进行此操作...很抱歉,我的长篇文字如此,但这是提出问题的最佳方法...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.