Следуя вашей логике, есть часть описания , за которой следует часть "тегов" , а затем закрывающая отметка комментария .
Если построчно проверять наличие ключевого слова тега, вы не сможете справиться с этой строкой:
* return false otherwise
Следовательно, вам необходимо определить, вошли ли вы из выхода из части тегов. Ниже рабочий пример:
import re
# Javascript content loading
JSF = open("your_js_file.js", 'r')
js_content = JSF.read()
# We split the script into lines, and then we'll loop through the array
lineiterator = iter(js_content.splitlines())
# This boolean marks if we are or not in a "tags" part
in_tags = False
for line in lineiterator:
# If we matched a line with a word starting with "@",
# Then we entered into a "tags" section
if re.search("@\w+", line) is not None :
in_tags = True
# If we matched a closing comment mark, then we left
# The "tags" section (or never entered into it)
if re.search("\*/",line) is not None:
in_tags = False
if not in_tags:
print(line)