Seach inside a string

Acconssmistit

New Member
\[code\]$variable = 'of course it is unnecessary [http://google.com], but it is simple["very simple"], and this simple question clearlyneeds a simple, understandable answer [(where is it?)] in plain English'\[/code\]Value of this variable everytime changes.What I trying to do is to get the text from \[code\][...]\[/code\]. So, if there is \[code\][(google)]\[/code\], the match should be \[code\](google)\[/code\].I'm searching for a solution, which can do each of these actions:[*]get all matches of [...], write into \[code\]$all\[/code\][*]get only the first match, write into \[code\]$first\[/code\][*]get only the last match, write into \[code\]$last\[/code\][*]remove all matches of [...] from the variable (erase)[*]remove only first match[*]remove only last matchTried different regex for this, like \[code\]/[\(.*?\)]/\[/code\], but the results aren't what one might expect.Thanks for your attention, any help would be appreciated.
 
Back
Top