Skip to content

Commit

Permalink
\w != [a-z0-9]
Browse files Browse the repository at this point in the history
  • Loading branch information
Caius-Bonus committed Oct 20, 2023
1 parent 656630f commit d1f98e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/string/slugify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const slugify = (value: string, delimiter = "_") => {
.toLowerCase()
.replace(p, (c) => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/(?<=\d),(?=\d)/g, "") // Remove Commas between numbers
.replace(/[^\w]+/g, delimiter) // Replace all non-word characters
.replace(/[^a-z0-9]+/g, delimiter) // Replace all non-word characters
.replace(new RegExp(`(${delimiter})\\1+`, "g"), "$1") // Replace multiple delimiters with single delimiter
.replace(new RegExp(`^${delimiter}+`), "") // Trim delimiter from start of text
.replace(new RegExp(`${delimiter}+$`), ""); // Trim delimiter from end of text
Expand Down

0 comments on commit d1f98e5

Please sign in to comment.