![]() |
#1 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
Regex for next "n" characters
I use h3 for headers for chapters. I would like to be able to make an id using regex.
I would like to take the next 5-7 characters out of the heading following <h3> and make it <h3 id="next5characters">. I suppose I could rename all the chapters so I could make an HTML TOC more easily, but this seems less work, if it can be made to work. Thanks. |
![]() |
![]() |
![]() |
#2 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
You can match any character with the dot, and use
Code:
..... You can also use Code:
.{5} |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,003
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Code:
(\S){2,5} You would need to do the rest |
|
![]() |
![]() |
![]() |
#4 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
It works out fine as
Find <h3>(.....) Replace <h3 id="\1">\1 |
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,539
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
In the particular one I was working on, neither was the case. I suppose in that case it would be simpler with chapter [1-9].... or something on that order. Fortunately they are not all like the one I was doing which is more like a pamphlet than a book.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
regex "?" with higher priority greedynes then the previous "?" ? | user743 | Editor | 1 | 05-04-2014 03:57 AM |
[Old Thread] Regex "FN LN" to "LN, FN" & reverse? | unboggling | Library Management | 19 | 11-20-2013 06:44 AM |
RegEx "All characters except" | linzerkipferl | Sigil | 1 | 09-16-2013 07:54 AM |
Regex or other method to find split quotations "" | CyanBC | Sigil | 9 | 05-14-2013 02:52 PM |