change/part doesn't work as expected with parse

Posted by Rebol Tutorial on Stack Overflow See other posts from Stack Overflow or by Rebol Tutorial
Published on 2010-04-13T16:03:17Z Indexed on 2010/04/13 21:23 UTC
Read the original article Hit count: 244

Filed under:

According to http://www.rebol.com/docs/core23/rebolcore-15.html

You can use change/part to parse and replace but that doesn't work well with this where I just try to replace the block

<mytag > ... </mytag>

by "MyString"

content:  {<mytag id="a" 111111111111111>
</mytag>
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
<mytag id="b" 22222222222222222>
</mytag>

<mytag id="c" 3333333333333>
</mytag>
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
<mytag id="d" 444444444444444>
</mytag>
}


mytag: [  to {<mytag} start: (
)
  thru {<mytag}
  to {id="} thru {id="} copy ID to {"} thru {"}
  to {</mytag>} 

  thru {</mytag>} 
  ending:

  (change/part start "mystring" ending)
  mark:
  (  write clipboard:// mark
  input)  
]

rule: [any mytag to end]

parse content rule

© Stack Overflow or respective owner

Related posts about rebol