BeautifulSoup document has an error

Bug #1651050 reported by 李宏杰
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Fix Released
Undecided
Unassigned

Bug Description

Document link:https://www.crummy.com/software/BeautifulSoup/bs4/doc/#a-regular-expression

'If you pass in a regular expression object, Beautiful Soup will filter against that regular expression using its match() method.'

By tested it, BeautifulSoup use search() method rather than match() method.

And if it use match(), there is no need use '^' in the example:

import re
for tag in soup.find_all(re.compile("^b")):
    print(tag.name)
# body
# b

Revision history for this message
Leonard Richardson (leonardr) wrote :

You're correct; 'match' in the documentation should be 'search'.

Changed in beautifulsoup:
status: New → Fix Committed
Changed in beautifulsoup:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.