# Pregmatch

**URL:** <https://forum.kirupa.com/t/pregmatch/271065>\
**Category:** programming\
**Created:** [September 17, 2008, 11:56pm UTC](https://forum.kirupa.com/t/pregmatch/271065 "2008-09-17T23:56:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [September 17, 2008, 11:56pm UTC](https://forum.kirupa.com/t/pregmatch/271065/1 "2008-09-17T23:56:00Z")

</div>

I have this string stored in $string:

```auto

<a href="google.com">google</a>
<a href="/submission/174583/hello/showmore,designs">a</a>
<a href="/submission/174584/world/showmore,designs">b</a>
<a href="/submission/174585/qbasic/showmore,designs">c</a>

```

It actually has no spaces. I just put in the line returns for readability.

How can I extract all the URL’s which are under the folder “submission”?

I tried this, but it failed miserably:

```php

preg_match('/submission\/([0-9]+)\//', $string, $match);

```

$match[0] contained “submission/174583”  
$match[1] contained “174583”
