.match()
. Para usar o método .match()
, aplique o método em uma string e passe o regex dentro dos parênteses. Aqui está um exemplo: "Olá, mundo!". Match (/ Hello /);
// Retorna ["Olá"]
vamos ourStr = "Expressões regulares";
vamos ourRegex = / expressões /;
ourStr.match (ourRegex);
// Retorna ["expressões"]
.match()
. Para usar o método .match()
, aplique o método em uma string e passe o regex dentro dos parênteses. Aqui está um exemplo: "Hello, World!". Match (/ Hello /);
// Retorna ["Hello"]
let ourStr = "Regular expressions";
let ourRegex = / expressions /;
ourStr.match (ourRegex);
// Retorna ["expression"]
.match()
para extrair a coding
palavras. .match()
para extrair a palavra coding
. result
deve ter a palavra coding
- testString: 'assert(result.join() === "coding", "The result
should have the word coding
");'
+ testString: 'assert(result.join() === "coding", "O result
deve ter a palavra coding
");'
- text: Seu regex codingRegex
deve procurar por coding
- testString: 'assert(codingRegex.source === "coding", "Your regex codingRegex
should search for coding
");'
+ testString: 'assert(codingRegex.source === "coding", "Seu regex codingRegex
deve procurar por coding
");'
- text: Você deve usar o método .match()
.
- testString: 'assert(code.match(/\.match\(.*\)/), "You should use the .match()
method.");'
+ testString: 'assert(code.match(/\.match\(.*\)/), "Você deve usar o método .match()
.");'
```