summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2014-12-11 22:08:09 -0500
committerLeonard Richardson <leonardr@segfault.org>2014-12-11 22:08:09 -0500
commit3c133d8d12f314ff3d70195cc0422e8e087b7829 (patch)
treec9794e8351276c03d21693bf8f747a8a52741187 /bs4/element.py
parent39eb079dae82d787362cc495e874b6fdeb6b8612 (diff)
The select() method can now find tags whose names contain
dashes. Patch by Francisco Canas [bug=1276211]
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 197722d..1127c7a 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -548,17 +548,17 @@ class PageElement(object):
# Methods for supporting CSS selectors.
- tag_name_re = re.compile('^[a-z0-9]+$')
-
- # /^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
- # \---/ \---/\-------------/ \-------/
- # | | | |
- # | | | The value
- # | | ~,|,^,$,* or =
- # | Attribute
+ tag_name_re = re.compile('^[a-zA-Z0-9][-.a-zA-Z0-9:_]*$')
+
+ # /^([a-zA-Z0-9][-.a-zA-Z0-9:_]*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
+ # \---------------------------/ \---/\-------------/ \-------/
+ # | | | |
+ # | | | The value
+ # | | ~,|,^,$,* or =
+ # | Attribute
# Tag
attribselect_re = re.compile(
- r'^(?P<tag>\w+)?\[(?P<attribute>\w+)(?P<operator>[=~\|\^\$\*]?)' +
+ r'^(?P<tag>[a-zA-Z0-9][-.a-zA-Z0-9:_]*)?\[(?P<attribute>\w+)(?P<operator>[=~\|\^\$\*]?)' +
r'=?"?(?P<value>[^\]"]*)"?\]$'
)