<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Replace ALL occurrences of a match in a string in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Replace-ALL-occurrences-of-a-match-in-a-string/m-p/520028#M74598</link>
    <description>&lt;P&gt;For your side question: You cannot easily split with many characters by using Word(s). You might be able to use Regex Match OR you could first replace all ", " (Substitute, Regex) with some special character and then split on that using Word(s).&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jul 2022 05:49:22 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2022-07-12T05:49:22Z</dc:date>
    <item>
      <title>Replace ALL occurrences of a match in a string</title>
      <link>https://community.jmp.com/t5/Discussions/Replace-ALL-occurrences-of-a-match-in-a-string/m-p/519946#M74592</link>
      <description>&lt;P&gt;Let's say I have a very long string, which essentially are just field names, comma separated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem, when trying to break it into separate fields, is that some names have comma inside them, like "{0,0}" or "{45,-45}" or "{90,90}".&lt;/P&gt;&lt;P&gt;In order to separate this long string into fields I need to replace that comma with something.&lt;/P&gt;&lt;P&gt;This is a small piece of that string: "Normal_0_{0,0}, Normal_90_{45,-45}" - so I need to replace only that comma that inside curly brackets.&lt;/P&gt;&lt;P&gt;So I wrote this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;matches = Regex (longLine, "(\{\d{1,2})(,)(-?\d{1,2}\})", "\1|\3");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It's supposed to replace all the commas inside the string. But in reality it only replaces the first comma in the string.&lt;/P&gt;&lt;P&gt;Why? And how can I replace ALL the matches?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Side question: In this code&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Word(1, "Normal_0_{0,0}, Normal_90_{45,-45}" ,  ", ")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;it would split the string by EITHER "," OR " ". How can I split by COMBINATION of characters, specifically split by ", " - comma followed by space?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:04:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replace-ALL-occurrences-of-a-match-in-a-string/m-p/519946#M74592</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2023-06-09T17:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Replace ALL occurrences of a match in a string</title>
      <link>https://community.jmp.com/t5/Discussions/Replace-ALL-occurrences-of-a-match-in-a-string/m-p/519955#M74593</link>
      <description>&lt;P&gt;As usual, few minutes after posting I bumped into the answer in the documentation.&lt;/P&gt;&lt;P&gt;All I needed was GLOBALREPLACE:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;matches = Regex (longLine, "(\{\d{1,2})(,)(-?\d{1,2}\})", "\1|\3", GLOBALREPLACE);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jul 2022 23:53:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replace-ALL-occurrences-of-a-match-in-a-string/m-p/519955#M74593</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2022-07-11T23:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Replace ALL occurrences of a match in a string</title>
      <link>https://community.jmp.com/t5/Discussions/Replace-ALL-occurrences-of-a-match-in-a-string/m-p/520028#M74598</link>
      <description>&lt;P&gt;For your side question: You cannot easily split with many characters by using Word(s). You might be able to use Regex Match OR you could first replace all ", " (Substitute, Regex) with some special character and then split on that using Word(s).&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 05:49:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replace-ALL-occurrences-of-a-match-in-a-string/m-p/520028#M74598</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-07-12T05:49:22Z</dc:date>
    </item>
  </channel>
</rss>

