Skip to content

Commit

Permalink
also regex escape in the parent keyword.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomrittervg committed Mar 30, 2012
1 parent 51a9000 commit d75f510
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions synonymmapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ def getMap():
keyword = r[DB.keyword.keyword].lower()
keyword = keyword.replace(".", "\.") # Any regex metacharacters in the keyword need to be escaped.
keyword_regex = re.compile('(?<=[^a-zA-Z])' + keyword + '(?![a-zA-Z])') # k is not surrounded by alpha characters.
parent = r[DB.keyword.parent]
parent_regex = '' if not parent else re.compile('(?<=[^a-zA-Z])' + parent.lower() + '(?![a-zA-Z])')

parent = r[DB.keyword.parent].lower()
parent = parent.replace(".", "\.") # Any regex metacharacters in the parent also need to be escaped.
parent_regex = '' if not parent else re.compile('(?<=[^a-zA-Z])' + parent + '(?![a-zA-Z])')

type = r[DB.keyword.type]

if not map.has_node(keyword):
Expand Down

0 comments on commit d75f510

Please sign in to comment.