| 11 | results = SearchResults() |
| 12 | |
| 13 | def perform_search(content, search_str): |
| 14 | name_pattern = re.compile(r'// @name:\s*' + re.escape(search_str) + r'\s*(.+)') |
| 15 | description_pattern = re.compile(r'// @description:\s*' + re.escape(search_str) + r'\s*(.+)') |
| 16 | results.name_matches.extend([match.strip() for match in name_pattern.findall(content)]) |
| 17 | results.description_matches.extend([match.strip() for match in description_pattern.findall(content)]) |
| 18 | |
| 19 | try: |
| 20 | with open(file_path, 'r', encoding='utf-8') as file: |