Exercise: Using recursion and regular expressions

Modify the recursive example to include a function changeText that consumes a node, a patternA way of specifying a set of strings for a regular expression., and a modifierInformation on what type of matches should be allowed for a regular expression. and changes all descendantA child or child of a child or so on. text nodes using that pattern and modifier. Using the function, remove all the lower-case vowels from the text on the page.

Note:

Hints:

  • Make sure to use all three parameters each time you call the function changeText.

Solution to the exercise

Here is one possible solution.

Note:

Hints:

  • undefined
1
2
window.onload = startFunction;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX