# Spot the bug - #157: Slug Formatter

**URL:** https://forum.kirupa.com/t/spot-the-bug-157-slug-formatter/683491
**Category:** web dev
**Created:** [September 27, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-157-slug-formatter/683491 "2026-09-27T07:00:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Quelly](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/quelly/32/31386_2.png) [@Quelly](https://forum.kirupa.com/u/Quelly)
#### Post date: [September 27, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-157-slug-formatter/683491/1 "2026-09-27T07:00:07Z")

</div>

One regex bug in this formatter.

```js
function slugify(title) {
  return title.trim().toLowerCase().replace('/\s+/g', '-');
}

console.log(slugify('Hello World Again'));

```

Reply with what is broken and how you would fix it.
