ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

[Solved] Regexmatch in PHP serialized data?

(1/1)

highend01:
Hi,

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}";}}}}';
--- End quote ---

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}";}
--- End quote ---

The real innermost pair of {} would be:
{new tag}
--- End quote ---
but this is inside a double quoting
"batch file {new tag}"
--- End quote ---
and therefore shouldn't be treated as the innermost {}...

Navigation

[0] Message Index

Go to full version