I SOLVED THE REGEX SYNTAX!!!!

Options

@Lachlan McPherson I figured it out!!!! Here's the situation…

I needed to be able to take a numbered list and break each sentence generated in the numbered list. However, whenever there were non-letter or numeric characters like "''.?/" it would cause my syntax to only return a partial sentence, leaving the rest of my work to get messed up… Here's an example of a numbered list that would work ok with the previous regex command i had found somewhere:

Regex Syntax:

/((\d+. ))([\s\S](\w+(\s|?|: |\r|\n|$))*)/

with a list like this:

  1. Unlock the Secrets to Boosting Your Online Visibility with Video Marketing
  2. The Ultimate Guide to Creating Engaging Videos That Drive Results
  3. Get More Views and Conversions with These Video Marketing Tips
  4. Discover the Power of Video Marketing: "Strategies for Success"
  5. The Top Video Marketing Trends to Watch in 2021
  6. Maximize Your ROI: How Video Marketing Can Help You Achieve Your Business Goals
  7. Revolutionize Your Marketing Strategy with Video Content
  8. From Zero to Hero: How Video Marketing Can Help You Dominate Your Industry
  9. The Ultimate Video SEO Checklist for Higher Rankings and More Traffic
  10. The Future of Marketing is Video: Are You Ready to Join the Revolution?

and where it would break would be if there was any character other than a letter or number.

and then somewhere in the regExr.com cheatsheet, there was the "." - any character other than a line break… so i stripped away all the other capturing groups after the ((\d+.)) which means any number with a period and space afterwards… and voila!!!!

/(?!\d+. ) (.)+/

This, right here will match only the sentence including all characters and omit the number and period that precedes that sentence!

Comments

  • Lachlan
    Lachlan Administrator

    ADMIN

    Options

    Hey Kevin,

    Well done - as mentioned Regex has always been something I've offloaded as it makes my head hurt haha.

    Glad you were able to crack it, and more importantly thank you for sharing how you achieved it!

    And as a shameless plug for you, if anyone needs a dope studio setup that looks epic on zoom calls, Kevin is your guy! Hit him up.