RegEx: Boundary Assertions II

Published by Werdna in

You are given an array with random words but your program doesn't accept words that begin with the capital letter "C". Using regex, remove the unaccepted words and return the new array.

Examples

accepted_words(["Ducks", "Bears",  "Cats"]) ➞ ["Ducks", "Bears"]

accepted_words(["cars", "trucks", "planes"]) ➞ ["cars", trucks", "planes"]

accepted_words(["Cans", "Worms", "Bugs", "Cold", "Beans"]) ➞ ["Worms", "Bugs", "Beans"]

Notes

Use a RegEx in your function.

Watch a quick demo on how Edabit works.