Last active
August 29, 2015 13:56
-
-
Save WayneCui/9188031 to your computer and use it in GitHub Desktop.
Red Parse测试
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [] | |
str: "<Ids></Ids><Names></Names><Ids>99</Ids><Names>bar</Names>" | |
rule-1: [ | |
some [ | |
thru "<Ids>" insert "01" [ "</Ids>" | insert "," ] | |
thru "<Names>" insert "foo" [ "</Names>" | insert ","] | |
] | |
] | |
rule-2: [ | |
some [ | |
thru "<Ids>" insert "01" [ not "</Ids>" insert "," | skip ] | |
thru "<Names>" insert "foo" [ not "</Names>" insert "," | skip ] | |
] | |
] | |
parse str rule-1 | |
;parse str rule-2 | |
probe str | |
;output | |
;{<Ids>01</Ids><Names>foo</Names><Ids>01,99</Ids><Names>foo,bar</Names>} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment