Jump to content

Preg_Match Help


atlanta

Recommended Posts

Hey i needed a little help with selecting the stuff in between this code

using the preg_match function . i dont know how to right the expression correctly to get the stuff in between the table table table { and }

 

table table table {

border-style:solid;

border-width:1px;

border-color:A47040;

background-color:EEE3CF; 

 

So i would want the regex function to return

border-style:solid;

border-width:1px;

border-color:A47040;

background-color:EEE3CF;

 

could someone help me out with writting the expression correctly thanks

Link to comment
https://forums.phpfreaks.com/topic/101467-preg_match-help/
Share on other sites

i'm not the best at regex but

 

<?php

$string = "table table table {
border-style:solid;
border-width:1px;
border-color:A47040;
background-color:EEE3CF; 
}";

$pattern = "/table table table {(.*?)}/is";

$woo = preg_match_all($pattern, $string, $style);

echo nl2br($style[1][0]);
?>

 

my results:

 


border-style:solid;
border-width:1px;
border-color:A47040;
background-color:EEE3CF; 

Link to comment
https://forums.phpfreaks.com/topic/101467-preg_match-help/#findComment-519039
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.