diff --git a/module3.ipynb b/module3.ipynb index 709d82c..24b3064 100644 --- a/module3.ipynb +++ b/module3.ipynb @@ -1,5 +1,51 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Regular Expressions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Basic Matching" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "None\n", + "\n", + "\n", + "\n", + "\n" + ] + } + ], + "source": [ + "import re\n", + "result1 = re.search(r\"aza\", \"plaza\")\n", + "result2 = re.search(r\"aza\", \"bazaar\")\n", + "print(result1)\n", + "print(result2)\n", + "print(re.search(r\"aza\", \"maze\"))\n", + "print(re.search(r\"^x\", \"xenon\"))\n", + "print(re.search(r\"p.ng\", \"clapping\"))\n", + "print(re.search(r\"p.ng\", \"sponge\"))\n", + "print(re.search(r\"p.ng\", \"Pangaea\", re.IGNORECASE))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -9,8 +55,22 @@ } ], "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, "language_info": { - "name": "python" + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.3" } }, "nbformat": 4,