Chippo
Joined: 22 Apr 2008 Posts: 1
|
Posted: Tue Apr 22, 2008 11:43 pm Post subject: regexp find and seperate custom tags in a string |
|
|
Hi
I am working on a CMS system for myself, Im having a bit of trouble with some reg exp.
Say i have a text string like this...
| Code: |
{{startcontent_categories_box}}blah blah blah<br />
<br />
$p</p>
<table cellspacing="1" cellpadding="1" width="200" border="1">
<tbody>
<tr>
<td>username</td>
<td>password</td>
</tr>
<tr id="rowstart">
<td style="width: 250px"><strong>$username</strong></td>
<td style="width: 250px">$userpassword</td>
</tr>
</tbody>
</table>
<p><br />
{{endcontent_categories_box}} |
what I want to be able to do is run a reg exp which will find things like this on the page for me and seperate the content name, the start and end tags and the content within them.
content name would be 'categories_box'
start tag would be {{startcontent_categories_box}}
end tag would be {{endcontent_categories_box}}
and the content within would be all the html between the 2 tags.
Is this possible?
I have been trying myself but I am useless when it comes to reg exp, what I tried was...
| Code: |
| /{{startcontent_/\d{2,50}/}}(.*?){{endcontent_/\d{2,50}/}}$/mg |
If someone could help me with this it would be greatly appreciated |
|