regex

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pedroz
Forum Commoner
Posts: 99
Joined: Thu Nov 03, 2005 6:21 am

regex

Post by pedroz »

i was never good with regex... could you please help me?

1. Want to remove [stream ...] tags:
$content = "blah blah blah [stream provider=video flv=x:video.flv embed=false share=false width=450 height=253 dock=true controlbar=over bandwidth=high autostart=false /]";

$content = preg_replace( '/\[(stream provider)(.*)\/\]', '', $content);
I know the regex is wrong...


2. content= '[video title="vtitle" size=10 width=400 height=300]http://www.youtube.com/?v=xxx[/video]'

how can i get this?
$title=vtitle; size=10; width=400; height=300;
$url=http://www.youtube.com/?v=xxx
preg_match?

note, tag may be only
[video]http://www.youtube.com/?v=xxx[/video] or
[video title="vtitle" size=10]http://www.youtube.com/?v=xxx[/video]
(users do not use always full options)


Many, many... Thanks
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: regex

Post by AbraCadaver »

Try:

Code: Select all

$content = preg_replace( '#\[stream provider[^\]]+/\]#', '', $content); 
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply