- Регистрация
- 29.03.2011
- Сообщения
- 221
- Благодарностей
- 30
- Баллы
- 0
Hi, I need help.
My template writes a list of entries to a file, but sometimes it adds empty lines, which sucks big time.
I guess I found the problem, but I don't know how to reliably solve it:
The template grabs a block of text
Then it parses this block with this regex:
(you could try this in the expression builder:
before required text:#-music-#
after required text:#--#
Full text and shortest match ticked.
The problem is, it gives:
|
Get some here.
Wow.
|
|
(| stands for a blank line, inserted for dramatic reasons)
So a blank line above and two below!!!
How do I parse that block without getting the messy blank lines? I hope theres a better solution than deleting line 0 and lines end-1 and end-2 afterwards...
Thanks!
My template writes a list of entries to a file, but sometimes it adds empty lines, which sucks big time.
I guess I found the problem, but I don't know how to reliably solve it:
The template grabs a block of text
PHP:
#-music-#
Get some here.
Wow.
#--#
#-pictures-#
Get pics here.
#--#
PHP:
(?<=#-music-#)[\w\W]*?(?=#--#)
before required text:#-music-#
after required text:#--#
Full text and shortest match ticked.
The problem is, it gives:
|
Get some here.
Wow.
|
|
(| stands for a blank line, inserted for dramatic reasons)
So a blank line above and two below!!!
How do I parse that block without getting the messy blank lines? I hope theres a better solution than deleting line 0 and lines end-1 and end-2 afterwards...
Thanks!