View difference between Paste ID: jkXjZFJp and g9W4RtQz
SHOW: | | - or go back to the newest paste.
1-
salut, ma confrunt cu o situatie ciudata. Aceste FIND and REPLACE nu merg. Adica find merge, dar replace nu merge.
1+
Hi, I'm facing a strange situation. These FIND and REPLACE do not work. That is, finding works, but replacing does not work.
2
 
3-
In aceste 3 situatii, trebuie sa inlocuiesc un anuit regex cu (spatiu gol). Vezi acolo acel ' ' 
3+
In these 3 situations, I have to replace an annuit regex with (empty space). See that '' there
4-
Daca la re.findall as pune orice regex simplu, de exemplu un html tag <div> atunci se face inlocuirea perfect. 
4+
If at re.findall I put any simple regex, for example an html tag <div> then the replacement is done perfectly.
5-
Dar daca este un alt gen de regex, cum sunt cele de mai jos, inlocuirea nu se mai face. Adica nu se intampla nimic... 
5+
But if it is a different kind of regex, such as the ones below, the replacement is no longer done. I mean nothing happens ...
6
7
8
if len(re.findall('(?!<p>).+?(?<!</p>)$', page_text)) != 0:
9
   page_text = re.sub('(?!<p>).+?(?<!</p>)$', '', page_text)
10
   counter_img += 1
11
OR
12
13
if len(re.findall('^\s+</p>', page_text)) != 0:
14
   page_text = re.compile(r'', page_text)
15
   counter_img += 1
16
17
OR
18
19
if len(re.findall('\n\s*', page_text)) != 0:
20
   page_text = re.sub('\n\s*', '', page_text)
21
   counter_img += 1
22