Lesson

Match Characters that Occur One or More Times,freeCodeCamp Regex Tutorials Javascript, Learn to Code

Lesson Summary

Understanding regular expressions are key to becoming a well-rounded web developer and programmer. In this lesson, we learn how to find similar patterns that have characters that occur multiple or at least one time. We are able to use the plus sign (+) If we were to use the pattern "/a+/g" this would find a match in the string "abc" and would, therefore, return an array with an "a" character. ["a"] It would also find a match in the following string "aabc" and return the following array. ["aa"] Understanding that we can use this syntax to target a single character or a consecutive repeated character. It would, therefore, return ["a", "a"] if we had a string such as "abab". The a's are not together here because they don't occur one after the other.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required


Share: