home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomePHP CookbookSearch this book

11.10. Converting ASCII to HTML

11.10.3. Discussion

The more you know about what the ASCII text looks like, the better your HTML conversion can be. For example, if emphasis is indicated with *asterisks* or /slashes/ around words, you can add rules that take care of that, as follows:

$grafs[$i] = preg_replace('/(\A|\s)\*([^*]+)\*(\s|\z)/',
$grafs[$i] = preg_replace('{(\A|\s)/([^/]+)/(\s|\z)}',

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.