RegexpGarden










- Garden Text Representation
123456
let garden = [
"Rose", "Christmas Rose",
"Rosemary",
"Apple 'Gala Must 696'",
"Rose-of-Sharon"
];
- Code Editor
- Log
123456
for (const plant of garden) {
if (plant.match(//i) {
water(plant);
}
}
Lesson task •
Water plants that has no spaces in their names
Any single non-whitespace character
\S
Matches single character that is not space, \t, \n, \r, \f123
console.log(!!"4_2".match(/\w\S\w/)) // true
console.log(!!"4 2".match(/\w\S\w/)) // false
console.log(!!"42".match(/\S/)) // true