| Meta | Nome | Função |
|---|---|---|
. |
ponto | um caractere qualquer |
[] |
conjunto | conjunto de caracteres permitidos |
[^] |
conjunto negado | conjunto de caracteres proibidos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const regex = /(\((\d{2})\)\s?)?(\d{4,5})[-]?(\d{4})/gm; | |
| console.log(regex.test('(77) 95684-9783')); //true | |
| console.log(regex.test('(68)90499-9922')); //false | |
| console.log(regex.test('95088-2649')); //true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const text = ` | |
| - 58204-824 | |
| - 69337-978 | |
| - 69.938-863 | |
| - 7287498 | |
| `; | |
| const regex = /(\d{2}[.]?\d{3})[-]?(\d{3})/gm; | |
| console.log(text.match(regex)); | |
| // [ '58204-824', '69337-978', '69.938-863'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const text = "É só o amor, é só o amor Que conhece o que é verdade"; | |
| const regex = /o\samor/gi; | |
| console.log(text.replace(regex, "a dor")) | |
| //É só a dor, é só a dor Que conhece o que é verdade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const text = "2019-26-09"; | |
| const regex = /(\d{4})-(\d{2})-(\d{2})/g; | |
| console.log(text.replace(regex, "$2/$3/$1")); | |
| // 26/09/2019 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const texto = ` | |
| Lista de jogos: | |
| - Red dead redeption 2: R$ 180,00; | |
| - The last of us 2: R$ 199,95; | |
| - Resident Evil 2 remake: R$ 140,50; | |
| `; | |
| const regex = /(R\$)\s(\d*,\d*)/gmi; | |
| const funcao = (match, p1, p2) => { | |
| const real = parseFloat(p2.replace(/,/g,'.')); | |
| const cotacao = 4.21; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default [ | |
| { | |
| dataKey: 'id', | |
| title: 'Código', | |
| width: 100, | |
| sortable: true, | |
| align: 'center' | |
| }, | |
| { | |
| dataKey: 'thumbnail', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| id: 150, | |
| name: 'Mewtwo', | |
| thumbnail: "./assets/thumbnails/150.png", | |
| type: [ | |
| 'Psychic' | |
| ], | |
| hp: 106, | |
| attack: 110, | |
| defense: 90, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const App = () => { | |
| return ( | |
| <Table | |
| data={data} | |
| > | |
| {columnDefinition.map(({dataKey, ...restProps}) => ( | |
| <Column key={dataKey} dataKey={dataKey} {...restProps} /> | |
| ))} | |
| </Table> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const App = () => { | |
| return ( | |
| <Table | |
| data={data} | |
| loading={loading} | |
| rowKey="id" | |
| headerHeight={45} | |
| rowHeight={70} | |
| sortBy={sortBy} | |
| onColumnSort={handleOnColumnSort(data, setData, setSortBy)} |
OlderNewer