Regex Flashcards

1
Q

Using a basic Regex command write a variable named matches with a input of “hello” and print out he.

A

matches = “hello”.match(/h./)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

With the word hello how would replace the last letter with a y?

A

“hello”.replace(/o/, “y”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly