Thread: Regex examples
View Single Post
Old 06-05-2020, 06:31 AM   #644
d351r3d
Enthusiast
d351r3d began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
I want to be able to copy and replace with saved text kond of like how (\d+) saves the number or more than 1 number in a row and then you can output it with \1,\2, etc. Is there a way to do this with all text in between tags. An example would be:

Code:
<p><b>20</b> Words and stuff. Why are there words?<br/><b>20</b> Words and stuff. Why are there words?</p>
I realize that I can (\d+) the numbers and replace them elsewhere with \1.

Find
Code:
<p><b>(\d+)</b>\s … <br/><b>\d+</b>\s … </p>
Replace
Code:
<h4>\1</h4></br><p> … </p><p> … </p>
I figured it out.

Find
Code:
<p><b>(\d+)</b>\s(.*?)<br/><b>\d+</b>\s(.*?)</p>
Replace
Code:
<h4>50:\1</h4><p>\2</p><p>\3</p>
d351r3d is offline   Reply With Quote