DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: [Solved] Regexmatch in PHP serialized data?  (Read 4,987 times)

highend01

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 188
[Solved] Regexmatch in PHP serialized data?
« on: May 08, 2015, 06:58 AM »
Hi,

Edit: Solved, I wrote a function that parses all pairs...

for example I have the following string:
Quote
$a = 'a:1:{s:9:"@test.bat";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:10:"users_meta";a:1:{s:4:"tags";s:20:"batch file {new tag}";}}}}';

Is there an intelligent way (the used regex engine (Visual Basic (no .NET) is "mostly" pcre compatible. One exception: Positive & negative lookbehinds aren't supported) to get the content of the innermost {} pair that is NOT inside quotation marks?

In this case I'd like to match exactly this part:
Quote
{s:4:"tags";s:20:"batch file {new tag}";}

The real innermost pair of {} would be:
Quote
{new tag}
but this is inside a double quoting
Quote
"batch file {new tag}"
and therefore shouldn't be treated as the innermost {}...
« Last Edit: May 08, 2015, 08:36 AM by highend01 »

Original address: https://www.donationcoder.com/forum/index.php?topic=40869.0