A tricky replacement expression
Posted: Wed Oct 31, 2001 3:23 pm
Hi!
I have a text with headings like this
1 Heading Level1
2.1 Heading Level2
2.1.1 Heading Level3
2 Heading Level1
and I want to get it into HTML tagged version like
<h1>1 Heading Level1</h1>
<h2>2.1 Heading Level2</h2>
<h3>2.1.1 Heading Level3</h3>
<h1>2 Heading Level1</h1>
Can anyone tell if it's possible to do this with one replace command?
I have been doing like this:
First I add tags to Level 3 like
Find: ^\([0-9]+.[0-9]+.[0-9]+ .*\)$
Replace: <h3>\1</h3>
Then Level 2 headings with one .[0-9]+ less etc.
Thanks,
Mikko
I have a text with headings like this
1 Heading Level1
2.1 Heading Level2
2.1.1 Heading Level3
2 Heading Level1
and I want to get it into HTML tagged version like
<h1>1 Heading Level1</h1>
<h2>2.1 Heading Level2</h2>
<h3>2.1.1 Heading Level3</h3>
<h1>2 Heading Level1</h1>
Can anyone tell if it's possible to do this with one replace command?
I have been doing like this:
First I add tags to Level 3 like
Find: ^\([0-9]+.[0-9]+.[0-9]+ .*\)$
Replace: <h3>\1</h3>
Then Level 2 headings with one .[0-9]+ less etc.
Thanks,
Mikko