Created
June 2, 2020 23:56
-
-
Save westc/a917c1d7981c8301baf9309c0847844d to your computer and use it in GitHub Desktop.
Regular Expressions - JavaScript Examples & Python Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rgx = /[aeiou]{2,}/; | |
let numbers = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"]; | |
let filteredNumbers = numbers.filter(n => rgx.test(n)); // ["Three", "Four"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rgx = re.compile(r"[aeiou]{2,}") | |
numbers = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"] | |
filteredNumbers = [n for n in numbers if rgx.search(n) is not None] # ["Three", "Four"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment