Hello fellow Bubblers!
I am trying to create a slug from a text value. Take for example a blog post titled: This is My Blog Title!!!
The slug should be something like: this-is-my-blog-title
Space and punctuation stripped out.
I’m trying to use regex to make this happen. Here is where I got so far.
- First I’m making the entire string lowercase
- Find and replace ! with null space
- Find and replace with regex expression [^0-9a-zA-Z]+
The issue I’m running into is that I still end up with the “-” at the end of the slug.
Does anyone have experience with the sort of issue?