PDA

View Full Version : Parse code with RegExp


missing-score
02-10-2003, 10:47 PM
Right, now I'll get to the point. I am making a small program mainly to increase my knowledge of PHP. ( You can find it at www.missingscore.co.uk )

It is an e-mail program, with lots of added features, and I have recently decided to add a rich e-mail function. ( Eg: HTML + Images )

I developed a code to use similar to the vB code on this site, and I used Regular Expressions to convert it to 2 versions, one without any tags at all, the other with fully formatted HTML. eg:

Text

--- Would output

1. Text
2. <font color="red">Text</font>

This is good, but there is a problem, ( think ) when it backslashes characters.

I have put all the files in a zip file so I would appreciate someone taking a look.

This is sort of what I want it to look like in the end:
www.missingscore.co.uk/ftry.php

Matt

beetle
02-11-2003, 04:41 PM
Why not use PHP's addslashes() and stripslashes() ?

ca_redwards
02-11-2003, 07:15 PM
Is in a bookmarklet builder (http://www24.brinkster.com/bookmarklets/jsbuilder.htm) that even formats your javascript code (indented C-style). Because it is intended for use in building single-line javascripts, it balks about end-of-line comments (you can always use in/multi-line comments!) and perhaps even adds clarifying curly brackets when needed.

Personally, I use jEdit (http://www.jedit.org) for editing everything (Java, JavaScript, HTML, etc) because of its excellent syntax highlighting and context-sensitive help for Java. But I use the bookmarklet builder (http://www24.brinkster.com/bookmarklets/jsbuilder.htm) to "pretty print" my javascript code.