<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: parse-replace code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 18 May 2008 00:06:27 GMT</pubDate>
    <description>DZone Snippets: parse-replace code</description>
    <item>
      <title>parse-replace - parse-based replace; faster; doesn't change series in place</title>
      <link>http://snippets.dzone.com/posts/show/2049</link>
      <description>&lt;code&gt;&lt;br /&gt;    parse-replace: func [&lt;br /&gt;        {Replaces the search value with the replace value within the target series.}&lt;br /&gt;        target [series!] "Series that is being modified."&lt;br /&gt;        search "Value to be replaced."&lt;br /&gt;        replace "Value to replace with."&lt;br /&gt;        /all "Replace all occurrences."&lt;br /&gt;        /case "Case-sensitive replacement."&lt;br /&gt;        /local len data rule text&lt;br /&gt;    ][&lt;br /&gt;        len: length? search&lt;br /&gt;        collect/into data [&lt;br /&gt;            rule: [&lt;br /&gt;                [copy text to search (if text [data: join text replace]) len skip]&lt;br /&gt;                copy text to end (if text [data: text])&lt;br /&gt;            ]&lt;br /&gt;            if all [insert rule 'any]&lt;br /&gt;            either case [parse/all/case target rule] [parse/all target rule]&lt;br /&gt;        ] copy make target length? target&lt;br /&gt;    ]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 17 May 2006 01:37:48 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2049</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
    <item>
      <title>parse-replace - parse-based REPLACE function</title>
      <link>http://snippets.dzone.com/posts/show/2048</link>
      <description>&lt;code&gt;&lt;br /&gt;    parse-replace: func [&lt;br /&gt;        {Replaces the search value with the replace value within the target series.}&lt;br /&gt;        target [series!] "Series that is being modified."&lt;br /&gt;        search "Value to be replaced."&lt;br /&gt;        replace "Value to replace with."&lt;br /&gt;        /all "Replace all occurrences."&lt;br /&gt;        /case "Case-sensitive replacement."&lt;br /&gt;        /local len skip-len rule text&lt;br /&gt;    ][&lt;br /&gt;        len: length? form search&lt;br /&gt;        skip-len: length? form replace&lt;br /&gt;        rule: copy [&lt;br /&gt;            [to search mark: (change/part mark replace len) skip-len skip]&lt;br /&gt;            to end&lt;br /&gt;        ]&lt;br /&gt;        if all [insert rule 'any]&lt;br /&gt;        either case [parse/all/case target rule] [parse/all target rule]&lt;br /&gt;        target&lt;br /&gt;    ]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 17 May 2006 01:36:32 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2048</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
  </channel>
</rss>
