|
Posted by Steve on 04/27/07 05:12
"Vince Morgan" <vinhar@REMOVEoptusnet.com.au> wrote in message
news:46317b63$0$9772$afc38c87@news.optusnet.com.au...
| "Vince Morgan" <vinhar@REMOVEoptusnet.com.au> wrote in message
| news:4630e557$0$6918$afc38c87@news.optusnet.com.au...
| > > But when I change a color, this script puts for example <font
| > color=#CCCCCC>
| > > in front of letters but I need <font color="#CCCCCC"> because Flash
| won't
| > > read it without quotes. And I can't say str_replace #CCCCCC with
| "#CCCCCC"
| > > because I don't know wich color the person will choose.
| > >
| > > Please if you have some idea help me!
| > >
| > >
| >
| > $in = 'This is <font-color=#CCCCCC>a color';
| > $out = preg_replace('/(font-color=)(#)([0-9a-fA-F]+)(\>)/',
| > '\\1'.'"\\2'.'\\3'.'"\\4', $in);
| >
| > I don't have much experience with regular expressions, but this may do
it
| > ana;
| > I would test it carefully first;
|
| And I wouldn't trust me not to write "<font-color" instead of <font color
| If you try to use the expresions without changing that nothing will
happen.
haven't we all done that? man, i really get mad at myself when i forget the
javascript equivalent styles...like backgroundColor v. css'
background-color. i just have to remember javascript would try to subtract
color from background without this nuance.
:)
Navigation:
[Reply to this message]
|