Find with regex a particular word between 2 lines
-
Find with regex a particular word between 2 lines. For example I have this text:
<tr> <td><h1 class="den_articol" itemprop="name">Your Mirror</h1></td> </tr> <tr> <td class="text_dreapta">On Septembrie 05, 2017</td> </tr> </table> <sony> <p class="text_obisnuit"><span class="text_obisnuit2">* Notă:</span> <a href="watch?v=IB4P5t3JGlg" target="_new">Simply Red - Your Mirror</a></p> </div> <p align="justify" class="text_obisnuit style3"> </p>
The Ouput must be:
<sony>
My regex formula doesn’t work:
</table>([\s\S]*?)<p class="text_obisnuit">|\1
-
I am not sure I understand the question the right way, so I will try to go with the following hypothesis:
can’t you just type<sony>
into the Find field without the need of matching regex at all?
or perhaps:
type in Find
</table>\r\n(<.*>)\r\n<p class="text_obisnuit">
And in Replace:
\1
In this case of course bulletting the option to mach Regex, but not the .(point) checkbox?
-
@wonkawilly said in Find with regex a particular word between 2 lines:
</table>\r\n(<.*>)\r\n<p class=“text_obisnuit”>
doesn’t work. Regex must find only
<sony>
-
@Vasile-Caraus
You have only given one example for people to go off of. In order for anyone to give you robust advice that doesn’t fail on all sorts of corner cases, you should:- Provide at least two examples
- Preferably give at least one example that contains
<sony>
but should not be matched - Consider simplifying your examples to remove nonessential details that will confuse your would-be helpers
Doing this isn’t just considerate of other people’s time, it’s also more useful to you in the long run because the solution that other people provide may be simpler and more targeted.
-
@Vasile-Caraus said in Find with regex a particular word between 2 lines:
@wonkawilly said in Find with regex a particular word between 2 lines:
</table>\r\n(<.*>)\r\n<p class=“text_obisnuit”>
doesn’t work. Regex must find only
<sony>
Can’t you just type
<sony>
in Find textbox?
As you can see you don’t even need to mach regex for what you are asking for at the moment. If I am making a mistake than perhaps I need more help from you to better understand your needs. Please specify more details.
-
@wonkawilly I need a regex, because I wanna FIND and REPLACE in several html files…
I find a solution, super
FIND:
</table>\r\n\K(<.*>)|K\r\n<p class="text_obisnuit">
interesting is that I used
K
instead of\K