regex - Using regular expressions to match a word in Python -
I am using PRAW to create a reddit bot which says "alot" and a list of their username . I have trouble with regular expressions and how the string works. This is my code.
So I'm a regular expression, as a part of a string, many words Instead of looking for a lot of words, example ze too many whenever I run it, it will not get any comments that I have made. Any suggestions?
You are checking with string operation, not In
isMatch = any (string for string for string in word_to_match) first in here is a substrings There is nothing to do with RS.
In addition, there is an error in your start:
word_to_match = ['balot \ b'] 'b' Code code is 0x08 (backspace). To avoid such a trap, use the raw string syntax for always RE pattern:
word_to_match = [r '\ balot \ b'] Now you have two letters, backslash then b , which will interpret the meaning of RE "word boundary".
There may be other bugs but I do not try to see more than two bugs per question ...: -)
Comments
Post a Comment