Jun-28-2023, 06:46 AM
In my html file I have this line:
The problem is in Python.
FIND: (on line 18)
<div class="color-black mt-lg-0" id="hidden">, in</div> <a href="https://neculaifantanaru.com/en/leadership-pro.html" title="View all articles from Leadership Pro" class="color-green font-weight-600 mx-1" id="hidden">Leadership Pro</a>I use this regex:
^\s*<a href="(.*?)" title="View`in order to find this link
https://neculaifantanaru.com/en/leadership-pro.htmlIn notepad++ the regex search is ok !
The problem is in Python.
FIND: (on line 18)
b_content = re.search('^\s*<a href="(.*?)" title="View', new_file_content).group(1)REPLACE:
old_file_content = re.sub(', in <a href="(.*?)" title="Vezi', f', in <a href="{b_content}" title="Vezi', old_file_content)Gives me this error on line 18:
Traceback (most recent call last): File "<module2>", line 18, in <module> AttributeError: 'NoneType' object has no attribute 'group'I, also, try to change that line with:
b_content = re.match(r'^\s*<a href="(.*?)" title="View', new_file_content).group(1)but I get the same error.