GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Modul 29 von 33 · Medien

Match

Kostas Diakogiannis

Match

The Match function

The match function is another function, after the test function, that is very useful when working with regular expressions and testing strings.

There are two main differences than test.

1. The match function takes place on the tested string, and accepts the regex expression as an argument inside the function.

2. The match does not return a boolean like the test function, but an array of all the matches that have been found (in case of g modifier is active, otherwise only the first match). When we say matches, we mean the string itself.

This is very useful when we are trying to find out how many matches of the specified pattern we found in the tested string (the length of the array that comes back in this case).

Anleitung

Um im Kurs weiterzukommen, sende einen Versuch dieses Quiz ab. Du kannst ihn nach der letzten Frage absenden.

Zum gewählten Modul

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck