Hi Guys,
I get too lost when writing out regular expressions so could someone give me a little help please.
I want to search a string of a certain pattern, if it is the right pattern then extract the variable from the certain position.
This is the basic format of the string:
[CODE]{COLUMN VARIABLE}(Linked:{TABLE VARIABLE}
An example would be:
[code=php]$string=’area(Linked:areas)’;
The variable I want to extract is the ‘TABLE VARIABLE’, so in this example it would be ‘areas’
Once I have saved the variable I then want to use preg_replace to remove the brackets and contents so the end result will be something like this:
[code=php]
$STRING=’area(Linked:areas)’;
// Do some regex work here to extract table variable and delete brackets and contents
$COLUMN=’area’;
$TABLE=’areas’;
Any help much appreciated,
Ben