“String.Regex Match” Code-Antworten

regex.match

const paragraph = 'The quick brown fox jumps over the lazy dog. It barked.';
const regex = /[A-Z]/g;
const found = paragraph.match(regex);

console.log(found);
// expected output: Array ["T", "I"]
Gil Reich

String.Regex Match

const str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
const regexp = /[A-E]/gi;
const matches_array = str.match(regexp);

console.log(matches_array);
// ['A', 'B', 'C', 'D', 'E', 'a', 'b', 'c', 'd', 'e']
Vast Vendace

Regex exakte Übereinstimmung

use ^ and $ to match the start and end of your string
^matchmeexactly$
Friendly Hawk

Ähnliche Antworten wie “String.Regex Match”

Fragen ähnlich wie “String.Regex Match”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen