![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 243
Karma: 44444
Join Date: Mar 2014
Device: Kindle PW2 special offers removed by Amazon for FREE
|
regex "?" with higher priority greedynes then the previous "?" ?
I'm trying to make a regex to add <body>, </body> and </html> tags, wherever they are missing.
maybe this will work. Code:
(</head>\s*)(<body>)?([^(</(body|html)>)]+).* Code:
\1<body>\3</body></html> Code:
(</head>\s*)(<body>)?(.+)(</body>)?^^extra greedy^^\s?(</html>)?^^extra greedy^^ Code:
\1<body>\3</body></html> edit is at least the first regex valid and reliable? Last edited by user743; 05-10-2014 at 10:50 PM. |
![]() |
![]() |
![]() |
#2 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Just use beautify, it will add <body> and <html> ( and /) when missing.
|
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Old Thread] Regex "FN LN" to "LN, FN" & reverse? | unboggling | Library Management | 19 | 11-20-2013 06:44 AM |
Feature Request: configurable space setting for "Insert blank line" in "Look & Feel" | therealjoeblow | Calibre | 15 | 07-25-2011 03:14 PM |
Seriously thoughtful "Higher Education: How Colleges are Wasting our Money" | MartinParish | Lounge | 29 | 08-31-2010 10:13 AM |