Closed WalterEschenbach closed 2 years ago
👷 Deploy request for lansingcodes-staging accepted.
🔨 Explore the source changes: b429e2547b00560c60b937d11b5e8c7a0e394a2f
🔍 Inspect the deploy log: https://app.netlify.com/sites/lansingcodes-staging/deploys/61626990588be6000813ed2e
Alrighty, let me know if you have questions about the regexes. I think keeping each requirement in a separate regular expression would be easier to comment and maintain. They can be chained like this:
export default description => description
.trim()
// Remove ... at end of line
.replace(/\.\.\.$/, '')
// Remove emoji
// TODO: provide URL where this regex came from
.replace(
/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2580-\u27BF]|\uD83E[\uDD10-\uDDFF])/g,
''
)
// Replace the last period and everything after it
// TODO
// Replace --- and everything after it
// TODO
// Remove whitespace that may have appeared
.trim()
// Add ... to end
.concat('...')
When you're ready, @ me and I'll take a look. This is coming along really well! 🤘
Hi @egillespie , admittedly took me a little longer than anticipated. Took a couple of trainings on regular expressions - so time well spent. 🧠
The source for the emoji regex is simply a post that I saw on stack overflow - is the URL in the comment above the relevant line of code the correct way to cite a source?
Awesome - thank you! 🎉 🎆
Created a utility function to clean event descriptions prior to being displayed.
fixes #144
Code sandbox example here.