How Do You Do a regex Operation in Python without Importing a Module?

Problem scenario
You need a pattern matching function in a Python program, but you cannot use "import re". What should you do?

Possible Solution #1
Use the index() function.

Here is an example:

foobar = "abcdefghijklmnopqrstuvwxyz"

Possible Solution #2
Use the .starswith() function.

foobar = "abcdefghijklmnopqrstuvwxyz"

Possible Solution #3
Use the find() function.

foobar = "abcdefghijklmnopqrstuvwxyz"

Leave a comment

Your email address will not be published. Required fields are marked *