Skip to content

Commit 70c5711

Browse files
committed
RegEx
1 parent 8b0c73e commit 70c5711

File tree

33 files changed

+98
-0
lines changed

33 files changed

+98
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let myString = "Hello, World!";
2+
let myRegex = /Hello/;
3+
let result = myRegex.test(myString);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let waldoIsHiding = "Somewhere Waldo is hiding in this text.";
2+
let waldoRegex = /Waldo/;
3+
let result = waldoRegex.test(waldoIsHiding);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let petString = "James has a pet cat.";
2+
let petRegex = /cat|dog|fish|bird/;
3+
let result = petRegex.test(petString);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let myString = "freeCodeCamp";
2+
let fccRegex = /freeCodeCamp/i;
3+
let result = fccRegex.test(myString);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let extractStr = "Extract the word 'coding' from this string.";
2+
let codingRegex = /coding/;
3+
let result = extractStr.match(codingRegex);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let twinkleStar = "Twinkle, twinkle, little star";
2+
let starRegex = /twinkle/ig;
3+
let result = twinkleStar.match(starRegex);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let exampleStr = "Let's have fun with regular expressions!";
2+
let unRegex = /.un/;
3+
let result = unRegex.test(exampleStr);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let quoteSample = "Beware of bugs in the above code; I have only proved it correct, not tried it.";
2+
let vowelRegex = /[aeiou]/gi;
3+
let result = quoteSample.match(vowelRegex);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let quoteSample = "The quick brown fox jumps over the lazy dog.";
2+
let alphabetRegex = /[a-z]/gi;
3+
let result = quoteSample.match(alphabetRegex)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let quoteSample = "Blueberry 3.141592653s are delicious.";
2+
let myRegex = /[h-s2-6]/ig;
3+
let result = quoteSample.match(myRegex);

0 commit comments

Comments
 (0)