JSFiddle - React, Tailwind, and code Playground

by RenatoRamosPuma

HTML

<main id="Master">
  <div class="photo-gallery-RID459852 other any some">
  
  </div>
  
  <div class="photo-gallery-RID987410 other any some2 other2">
  
  </div>
  
  <div><div><div class="photo-gallery-369841 other any some">
  
  </div></div></div>
  
  <article>
  <div class="photo-gallery-RID36541 here now other any some"></div>
  </article>
  
</main>

JavaScript

$("#Master [class*='photo-']").replace(function (index, css) {
	return (css.match (/(^|\s)photo-\S+/g) || []).join(' ');
}, "");