Groups and ranges indicate groups and ranges of expression characters. The regular…
Jump to turn (6)
- 1Groups and ranges indicate groups and ranges of expression characters. The regul
- 2Create a function that takes an array as an argument and returns true or false d
- 3Create a function that takes two numbers as arguments (num, length) and returns
- 4Create a function to count the number of 1s in a 2D array. Examples countOnes([
- 5Create a function that takes a number (step) as an argument and returns the amou
- 6Create a function that returns the number of hashes and pluses in a string. Exam
- User
Groups and ranges indicate groups and ranges of expression characters. The regular expression x|y matches either "x" or "y".
const REGEXP = /blue|red/
"red flag".match(REGEXP) // red "blue flag".match(REGEXP) // blue
// Matches "blue" in "blue flag" and "red" in "red flag". Create a regular expression to match all red flag and blue flag in a string. You must use | in your expression. Flags can come in any order.
Examples "red flag blue flag".match(REGEXP) ➞ ["red flag", "blue flag"]
"yellow flag red flag blue flag green flag".match(REGEXP) ➞ ["red flag", "blue flag"]
"pink flag red flag black flag blue flag green flag red flag ".match(REGEXP) ➞ ["red flag", "blue flag", "red flag"] Notes Check the Resources tab if you get stuck. solve in javascript
- Assistant