# \[PHP\]\[RegExp\] More characters

**URL:** <https://forum.kirupa.com/t/php-regexp-more-characters/290361>\
**Category:** programming\
**Created:** [June 13, 2009, 11:18am UTC](https://forum.kirupa.com/t/php-regexp-more-characters/290361 "2009-06-13T11:18:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hyperized](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@Hyperized](https://forum.kirupa.com/u/Hyperized)\
**Post date:** [June 13, 2009, 11:18am UTC](https://forum.kirupa.com/t/php-regexp-more-characters/290361/1 "2009-06-13T11:18:19Z")

</div>

Hey people I ran into a little hiccup and I hope one of you can help me out.

I’m trying to build a query filter to replace ‘:1’, ‘:2’ etc with the input of the function. Example:

```auto
SELECT * FROM tickets WHERE ticket_id = :1

```

Then use:

```php
$binds = func_get_args();
foreach($binds as $index => $name)
{
    $this->query = preg_replace("/ \:$index/", " '".$name."'", $this->query);
}

```

To replace the query placeholders with real values (as delivered with the function).

Now this is working like a charm, however I run into a problem once I hit the 10’s or 100’s  
For example, the return value of :10 will be seen as 'valueof1’0. I figure my regular expression only takes the first character that is detected in account. How do I make it so it detects the first and if possible any next nummerical character till whitespace or the end of the string, ánd still include it in the replace process?

Thanks in advance!  
Hyperized
