\n",
"regex* | Match regex zero or more times (Kleene star) |
\n",
"regex? | Match regex one or zero times |
\n",
"regex+ | Match regex one or more times |
\n",
"regex{m} | Match regex `m` times |
\n",
"regex{m,n} | Match regex between `m` and `n` times (as many as possible) |
\n",
"
"
]
},
{
"cell_type": "code",
"execution_count": 132,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 132,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(re.search(r'a*','xxxxx'))"
]
},
{
"cell_type": "code",
"execution_count": 133,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 133,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(re.search(r'a+','xxxxx'))"
]
},
{
"cell_type": "code",
"execution_count": 134,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"source": [
"m = re.search(r'a+(.*)','aaba')"
]
},
{
"cell_type": "code",
"execution_count": 136,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"