Skip to content

Commit

Permalink
RegEx 101 with answers.ipynb: Simply and directly print values that a…
Browse files Browse the repository at this point in the history
…re None.

Did not update RegEx 101 without answers.ipynb,
because that's too much hassle.
Just before presentatoin,
copy RegEx 101 with answers.ipynb to RegEx 101 without answers.ipynb,
then collapse the output in RegEx 101 without answers.ipynb.

One might even have RegEx 101 without answers.ipynb
in the repo.
Have the students copy RegEx-101.ipynb at the tutorial
and collapse the output.
  • Loading branch information
james-prior committed Jul 26, 2016
1 parent 33a4570 commit b815437
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions RegEx 101 with answers.ipynb
Expand Up @@ -235,7 +235,7 @@
"text": [
"Batwoman\n",
"Batwowowowowoman\n",
"True\n"
"None\n"
]
}
],
Expand All @@ -252,7 +252,7 @@
"mo2 = batRegex.search('The Adventures of Batwowowowowoman')\n",
"print(mo2.group())\n",
"mo3 = batRegex.search('The Adventures of Batman')\n",
"print(mo3 == None)"
"print(mo3)"
]
},
{
Expand All @@ -267,7 +267,7 @@
"output_type": "stream",
"text": [
"HaHaHa\n",
"True\n"
"None\n"
]
}
],
Expand All @@ -283,7 +283,7 @@
"mo1 = haRegex.search('HaHaHa')\n",
"print(mo1.group())\n",
"mo2 = haRegex.search('Ha')\n",
"print(mo2 == None)"
"print(mo2)"
]
},
{
Expand Down Expand Up @@ -451,7 +451,7 @@
"output_type": "stream",
"text": [
"Hello\n",
"True\n"
"None\n"
]
}
],
Expand All @@ -469,7 +469,7 @@
"\n",
"# no match when Hello is not at the beginning\n",
"mo2 = beginsWithHello.search('He said \"Hello\"')\n",
"print(mo2 == None)"
"print(mo2)"
]
},
{
Expand All @@ -484,7 +484,7 @@
"output_type": "stream",
"text": [
"None\n",
"True\n"
"None\n"
]
}
],
Expand All @@ -499,7 +499,7 @@
"mo1 = endsWithNumber.search('Your number is 42')\n",
"print(mo1)\n",
"mo2 = endsWithNumber.search('Your number is forty two')\n",
"print(mo2 == None)"
"print(mo2)"
]
},
{
Expand All @@ -514,8 +514,8 @@
"output_type": "stream",
"text": [
"1234567890\n",
"True\n",
"True\n"
"None\n",
"None\n"
]
}
],
Expand All @@ -530,16 +530,16 @@
"mo1 = wholeStringIsNum.search('1234567890')\n",
"print(mo1.group())\n",
"mo2 = wholeStringIsNum.search('12345xyz67890')\n",
"print(mo2 == None)\n",
"print(mo2)\n",
"mo3 = wholeStringIsNum.search('12345 67890')\n",
"print(mo3 == None)"
"print(mo3)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": true
"collapsed": false
},
"outputs": [
{
Expand Down Expand Up @@ -693,14 +693,14 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3.0
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
"version": "3.4.3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit b815437

Please sign in to comment.