Need help with preg_replace interpreting {variables} with parameters

israelfuchsia

New Member
I want to replace \[quote\] \[code\]{youtube}Video_ID_Here{/youtube}\[/code\]\[/quote\]with the embed code for a youtube video. So far I have \[quote\] \[code\]preg_replace('/{youtube}(.*){\/youtube}/iU',...)\[/code\]\[/quote\]and it works just fine.But now I'd like to be able to interpret parameters like height, width, etc. So could I have one regex for this whether is does or doesn't have parameters? It should be able to inperpret all of these below...\[quote\] \[code\]{youtube height="200px" width="150px" color1="#eee" color2="rgba(0,0,0,0.5)"}Video_ID_Here{/youtube}\[/code\] \[code\]{youtube height="200px"}Video_ID_Here{/youtube}\[/code\] \[code\]{youtube}Video_ID_Here{/youtube}\[/code\] \[code\]{youtube width="150px" showborder="1"}Video_ID_Here{/youtube}\[/code\]\[/quote\]
 
Back
Top