title: How can I replace the specific character beginning and end of string?
body: <p>I used moment to get longDateFormat. Like this:</p>
  
  <pre><code>moment.locale(navigator.language || navigator.userLanguage);
  let dateFormat = moment.localeData().longDateFormat("L");
  </code></pre>
  
  <p>And I want get format of day and month.For ex:<br></p>
  
  <pre><code>DD/MM or MM/DD&lt;br&gt;
  DD,MM or MM,DD&lt;br&gt;
  etc... &lt;br&gt;
  </code></pre>
  
  <p>I used <code>DATE_NO_YEAR = dateFormat.replace(/[y,Y]/g, "")</code> to get format for date no year. But have one character at beginning or end of string.<br>
  How can I replace string or any solution that I can get format for day and month?</p>