Permalink
Browse files

week 1 and week 2 a2z notes

  • Loading branch information...
1 parent 4281783 commit 9d38470fd611bd53d0d986af3a58ce670350eb1e @shiffman committed Sep 12, 2016
@@ -26,8 +26,11 @@
<div class="quick-link">
<a href="/a2z/" class="secondary">About the course</a>
</div>
- <h5>Tutorials</h5>
- <div class="quick-link">
- <a href="/a2z/intro" class="secondary">Introduction - p5.js, JavaScript, and Strings</a>
- </div>
+ <h5>Tutorials</h5>
+ <div class="quick-link">
+ <a href="/a2z/intro" class="secondary">Introduction - p5.js, JavaScript, and Strings</a>
+ </div>
+ <div class="quick-link">
+ <a href="/a2z/regex" class="secondary">Regular Expressions</a>
+ </div>
</section>
File renamed without changes.
View
Oops, something went wrong.
@@ -10,5 +10,7 @@
<div class="course-week-list">
<h2>Notes</h2>
<a href="/a2z/intro" class="body-link primary">Introduction - p5.js, JavaScript, and Strings</a>
+ <br/>
+ <a href="/a2z/regex" class="body-link primary">Regular Expressions</a>
<br>
</div>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,41 @@
+// Scramble what the user enters into a text field
+
+// The scrambled text
+var inputElt;
+var regexElt;
+var outputElt;
+
+var globalElt;
+var caseElt;
+
+var lorum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
+
+function setup() {
+ noCanvas();
+ println("running");
+
+ // See how we can make a div
+ inputElt = select('#input');
+ regexElt = select('#regex');
+ outputElt = select('#output');
+ var button = select('#button');
+ button.mousePressed(process);
+ globalElt = select('#global');
+ caseElt = select('#case');
+}
+
+function process() {
+
+ var flags = '';
+ if (globalElt.elt.checked) flags += 'g';
+ if (caseElt.elt.checked) flags += 'i';
+
+ var regex = new RegExp(regexElt.value(),flags);
+ console.log(regex);
+ var input = inputElt.value();
+ var results = input.match(regex);
+ console.log(results);
+
+ outputElt.html(JSON.stringify(results, null, 2));
+
+}
View
@@ -7,14 +7,19 @@
}
/* For regex tutorial*/
-.regex {
+.a2zregex {
font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal,monospace;
background: #BBBBBB;
font-weight: bold;
color:#000000;
padding: 4px;
}
+/*.token.regex {
+ background-color: none;
+ color: #000;
+}*/
+
/* For closure tutorial */
.box {
Oops, something went wrong.

0 comments on commit 9d38470

Please sign in to comment.