Jump to content

Preg_split - Php Help Required


Recommended Posts



We have a number of strings, which take on the basic format of fieldname followed by value. Each fieldname always starts with {$ and ends with $}. The fieldname is always made up of alphanumerics and spaces. I need to split the strings by the fieldname, so I have two componets 1. Fieldname 2. Value


e.g. strings are:


string: {$begin Take$} My story began

string: {$a publication$} The daily newspaper

string: {$ date of creation$} 04/06/2007


- so I would then have the parsed data as:

fieldname:{$begin Take} value:My story began

fieldname:{$a publication} value:The daily newspaper

fieldname:{$ date of creation$} value:04/06/2007


We're doing this parsing in PHP and need the code/ help with the preg_split for this.

All help very much appreciated



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...