This is a static archive of the Python wiki, which was retired in February 2026 due to lack of usage and the resources necessary to serve it — predominately to bots, crawlers, and LLM companies.
Pages are preserved as they were at the time of archival. For current information, please visit python.org.
If a change to this archive is absolutely needed, requests can be made via the infrastructure@python.org mailing list.

Asking for Help: How to use reg. exp. to capture defined values from random text

...

(Note to admins ... this is my second attempt to add this page. The first time my carefully-crafted text was discarded by the confusing form to create this page. Thanks for that!)

Hi -

I'm a Python newbie. I HAVE and WILL CONTINUE to study the usages of regular expressions. But in the meantime, I'd appreciate any quick help that y'all can give me.

I'd like to learn how to capture data points defined by some known marker ('=', ':' or other) from random text. For example, I'd like to capture "date" and "ip address" from random text like:

"bla bla bla, loads of random data date = 03/04/2010 more random text ip address: 128.0.0.1 thanks for your help"

To clarify, I know the NAME of the value, I know the marker, I want to grab the value.

Thanks much for your help.

When answering questions, add the CategoryAskingForHelpAnswered category when saving the page. This will move the link to this page from the questions section to the answers section on the Asking for Help page.


CategoryAskingForHelp


2026-02-14 16:06