Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Florian 'floe' Echtler
@floe@hci.social  路  activity timestamp 3 days ago

Got totally stumped today by the difference between re.match() and re.search() in Python. 馃う

But seriously, why does re.match() even exist when it's just adding an implicit ^ in front of the regex?

#python

  • Copy link
  • Flag this post
  • Block
Florian 'floe' Echtler
@floe@hci.social replied  路  activity timestamp 3 days ago

As it turns out, the difference is a bit more complex than I remembered: https://stackoverflow.com/a/180993

Stack Overflow

What is the difference between re.search and re.match?

What is the difference between the search() and match() functions in the Python re module? I've read the Python 2 documentation (Python 3 documentation), but I never seem to remember it.
  • Copy link
  • Flag this comment
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About 路 Code of conduct 路 Privacy 路 Users 路 Instances
Bonfire social 路 1.0.0 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login