🔣

Regex Strip

Python23 lines· A small demonstration that reimplements Python's str.strip() method using regular expressions to remove leading and trailing whitespace.
Original project by @ibra-kdbra — view source on GitHub
Ready when you are
README· what to build

Regex Strip

A small demonstration that reimplements Python's str.strip() method using regular expressions to remove leading and trailing whitespace.

Example

The script runs on the hard-coded string " test ffs " and prints the result with leading and trailing whitespace removed:

$ python regex-strip.py
test ffs

How to run on localhost

python regex-strip.py

Dependencies

Standard library only (uses re).

regex-strip.py· Python 3.x
23 lines
Console· terminal