avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday July 21, 2024, 4:51 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

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


  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 188
    • View Profile
    • Donate to Member
[Solved] Regexmatch in PHP serialized data?
« on: May 08, 2015, 01:58 AM »

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

for example I have the following string:
$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:
{s:4:"tags";s:20:"batch file {new tag}";}

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