You are not logged in.
What I want is to wrap all the highlighted lines (except the regex rule on line 53 ) with "<p>" and </p>". Unfortunately, every regex I've tried to get to work on it hasn't done what I needed to. It would either wrap the whole page (even with the "U" option enabled), wrap every letter, or every word.
The goal is to match any line (or series of lines) that doesn't have any special markup around it and has an empty line above and below it. For example...
This:
(blank line)\n
Yay for paragraphs.\n
(blank line)
Would become this:
<p>
Yay for paragraphs.
</p>
That's all I want it to do.. I've read up on regular expressions on regex.info, consulted the guys at Freenode's #php, and also the guys at #regex. Unfortunately I wasn't able to get any meaningful help. For example, someone at #regex suggested that I use an HTML parser, which makes no sense because I'm only outputting HTML, not accepting it as input. Any help I could receive with this would be greatly appreciated. I've been wracking my brain over it for hours..
Last edited by xelados (2008-10-07 13:13:04)
Offline
Not sure about PHP, but in Python I can use something like "^\n$". I've seen people use "^$" to match blank lines before, too...
M*cr*s*ft: Who needs quality when you have marketing?
Offline
That doesn't seem to work, either... How do sources like MediaWiki, DokuWiki, or even Wordpress do theirs?
EDIT: I've decided to skip this part of my project for now. After some reading on wikipedia it seems that I need to setup a finite state machine of some sort, a lexer to create tokens, and then replace those with appropriate output. It'll probably be the most time consuming part, so I'll save it for last.
Last edited by xelados (2008-10-08 03:52:58)
Offline