@type text: str or compat.unicode @param text: Text to search for. @type encoding: str @param encoding: (Optional) Encoding for the text parameter. Only used when the text to search for is a Unicode string. Don't change unless you know what
(self, text, encoding="utf-16le", caseSensitive=False)
| 229 | """ |
| 230 | |
| 231 | def __init__(self, text, encoding="utf-16le", caseSensitive=False): |
| 232 | """ |
| 233 | @type text: str or compat.unicode |
| 234 | @param text: Text to search for. |
| 235 | |
| 236 | @type encoding: str |
| 237 | @param encoding: (Optional) Encoding for the text parameter. |
| 238 | Only used when the text to search for is a Unicode string. |
| 239 | Don't change unless you know what you're doing! |
| 240 | |
| 241 | @type caseSensitive: bool |
| 242 | @param caseSensitive: C{True} of the search is case sensitive, |
| 243 | C{False} otherwise. |
| 244 | """ |
| 245 | self.isUnicode = isinstance(text, compat.unicode) |
| 246 | self.encoding = encoding |
| 247 | self.caseSensitive = caseSensitive |
| 248 | if not self.caseSensitive: |
| 249 | pattern = text.lower() |
| 250 | if self.isUnicode: |
| 251 | pattern = text.encode(encoding) |
| 252 | super(TextPattern, self).__init__(pattern) |
| 253 | |
| 254 | def read(self, process, address, size): |
| 255 | data = super(TextPattern, self).read(address, size) |