# PHP regular expression question

**URL:** https://forum.kirupa.com/t/php-regular-expression-question/235335
**Category:** programming
**Created:** [August 10, 2007, 10:54am UTC](https://forum.kirupa.com/t/php-regular-expression-question/235335 "2007-08-10T10:54:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Aneurin\_Mark\_II](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/aneurin_mark_ii/32/1564_2.png) [@Aneurin\_Mark\_II](https://forum.kirupa.com/u/Aneurin_Mark_II)
#### Post date: [August 10, 2007, 10:54am UTC](https://forum.kirupa.com/t/php-regular-expression-question/235335/1 "2007-08-10T10:54:03Z")

</div>

Here’s some sample XHTML.

```auto
 <!-- 5-image layout -->
 <div class="loa_line">
  <div class="loa_trailer">{BOX_TRAILER}</div>
  <div class="loa_img1">{BOX1_IMAGE}</div>
 </div>
 <div class="header"></div>
 <div class="loa_line">
  <div class="loa_img2">{BOX2_IMAGE}</div>
  <div class="loa_img2">{BOX3_IMAGE}</div>
  <div class="loa_links">{BOX4_TEXT}</div>
 </div>

```

Let’s say I want to extract {\*} from this and store them as an array. My current preg\_split regex is:

```auto
"[\{(.*?)\}]"

```

This however gives me the following output:

```auto
Array ( [0] =>
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
)

```

It’s counted the number of {_} instances correctly (er, I think. It seems to have added one). However, it did not return the {_}. The array is populated with empty values.

How would I go about getting the "{\*}"s as strings in an array? I want to use them for a later function, see.
