Update extract-matches.portuguese.md (#26034)

This commit is contained in:
Peres Badial
2018-11-13 03:54:48 -06:00
committed by Juliano Rafael
parent 8bd3f6654c
commit e45c3d9025

View File

@ -6,37 +6,37 @@ videoUrl: ''
localeTitle: Extrair correspondências localeTitle: Extrair correspondências
--- ---
## Description ## Descrição
<section id="description"> Até agora, você só verifica se um padrão existe ou não em uma string. Você também pode extrair as correspondências reais encontradas com o método <code>.match()</code> . Para usar o método <code>.match()</code> , aplique o método em uma string e passe o regex dentro dos parênteses. Aqui está um exemplo: <blockquote> &quot;Olá, mundo!&quot;. Match (/ Hello /); <br> // Retorna [&quot;Olá&quot;] <br> vamos ourStr = &quot;Expressões regulares&quot;; <br> vamos ourRegex = / expressões /; <br> ourStr.match (ourRegex); <br> // Retorna [&quot;expressões&quot;] </blockquote></section> <section id="description"> Até agora, você só verificou se um padrão existe ou não em uma string. Você também pode extrair as correspondências encontradas usando o método <code>.match()</code> . Para usar o método <code>.match()</code> , aplique o método em uma string e passe o regex dentro dos parênteses. Aqui está um exemplo: <blockquote> &quot;Hello, World!&quot;. Match (/ Hello /); <br> // Retorna [&quot;Hello&quot;] <br> let ourStr = &quot;Regular expressions&quot;; <br> let ourRegex = / expressions /; <br> ourStr.match (ourRegex); <br> // Retorna [&quot;expression&quot;] </blockquote></section>
## Instructions ## Instrucões
<section id="instructions"> Aplique o método <code>.match()</code> para extrair a <code>coding</code> palavras. </section> <section id="instructions"> Aplique o método <code>.match()</code> para extrair a palavra <code>coding</code> . </section>
## Tests ## Testes
<section id='tests'> <section id='tests'>
```yml ```yml
tests: tests:
- text: O <code>result</code> deve ter a palavra <code>coding</code> - text: O <code>result</code> deve ter a palavra <code>coding</code>
testString: 'assert(result.join() === "coding", "The <code>result</code> should have the word <code>coding</code>");' testString: 'assert(result.join() === "coding", "O <code>result</code> deve ter a palavra <code>coding</code>");'
- text: Seu regex <code>codingRegex</code> deve procurar por <code>coding</code> - text: Seu regex <code>codingRegex</code> deve procurar por <code>coding</code>
testString: 'assert(codingRegex.source === "coding", "Your regex <code>codingRegex</code> should search for <code>coding</code>");' testString: 'assert(codingRegex.source === "coding", "Seu regex <code>codingRegex</code> deve procurar por <code>coding</code>");'
- text: Você deve usar o método <code>.match()</code> . - text: Você deve usar o método <code>.match()</code> .
testString: 'assert(code.match(/\.match\(.*\)/), "You should use the <code>.match()</code> method.");' testString: 'assert(code.match(/\.match\(.*\)/), "Você deve usar o método <code>.match()</code>.");'
``` ```
</section> </section>
## Challenge Seed ## Desafio
<section id='challengeSeed'> <section id='challengeSeed'>
<div id='js-seed'> <div id='js-seed'>
```js ```js
let extractStr = "Extract the word 'coding' from this string."; let extractStr = "Extraia a palavra 'coding' da string.";
let codingRegex = /change/; // Change this line let codingRegex = /change/; // Altere esta linha
let result = extractStr; // Change this line let result = extractStr; // Altere esta linha
``` ```
@ -46,7 +46,7 @@ let result = extractStr; // Change this line
</section> </section>
## Solution ## Solução
<section id='solution'> <section id='solution'>
```js ```js