Replacing only first HTML tag on a page in RegEx -


i search first occurrence of html tag (and it's contents) , replace another. want search , replace stop after it's found first occurrence on page.

for example, @ top of each page in directory is:

 <h3>this title</h3> 

i want search , replace h3 tag h1 tag , leaving contents of tag same. outputted result be:

 <h1>this title</h1> 

the "this title" portion different on each page. using microsoft server program on server (called fnr.exe) search , replace , can handle regex.

i want occur on first instance of each document running find , replace with.

i have tried find: /h3>/g
replace: /h1>

that did not work. i'm not sure else do.

this ms program looks like:

enter image description here

i've tried use program seems popular windows called notepad++. screenshot of attempt. replaced occurances. (for testing on one, tried find first h2 tag , replace h1. replaced h2 tags.

enter image description here

i don't have ms programs you're going have test out on own think should after.

search for

^([\s\s]*?)<h3>(.*?)</h3> 

replace with

$1<h1>$2</h1> 

demo , explanation of regex, https://regex101.com/r/tb6rv2/2


Comments