Skip to content

Instantly share code, notes, and snippets.

@zazaulola
Created September 21, 2025 10:46
Show Gist options
  • Select an option

  • Save zazaulola/9232e194509bf4b0f166e3feeb9ccdbf to your computer and use it in GitHub Desktop.

Select an option

Save zazaulola/9232e194509bf4b0f166e3feeb9ccdbf to your computer and use it in GitHub Desktop.
Split a large string into strings of a specified length
const splitString = (str, num = 72) => str.split(new RegExp(`(?<=^(?:.{${num}})*)`,'g'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment