in reply to guestbook font [colors]
You actually have a couple of tasks. First split your input up into sentences. That is somewhat non-trivial for a start. However, modules like Lingua::EN::Sentence help solve that problem. Once you have an array of sentences you can process each one by:
use warnings; use strict; my @sentences = ( "This is [color]some text[/color].\n", "This is a [color]test[/color] oops![/color]\n", ); s!\[color\](.*)\[/color\]!\[blue\]$1\[/blue\]!g for @sentences; s!\[/?color\]!!g for @sentences; print for @sentences;
Prints:
This is [blue]some text[/blue]. This is a [blue]test oops![/blue]
Note the second pass to clean up any old markup that got left behind.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: guestbook font [colors]
by Anonymous Monk on Aug 09, 2006 at 04:14 UTC | |
by GrandFather (Saint) on Aug 09, 2006 at 04:21 UTC | |
by Anonymous Monk on Aug 09, 2006 at 04:29 UTC | |
by GrandFather (Saint) on Aug 09, 2006 at 04:37 UTC |