Re: [PHP] regular expression to extract from the middle of a string

2006-07-14 Thread Russell Jones
Ill probably get attacked viciously for this with pitchforks and machetes, but I get sick and tired of trying to figure out regular expressions a lot of times, so I use the following functions... getSingleMatch(), getMultiMatch(), getSingleMatchBackwards() function getSingleMatch($start,$end,$co

Re: [PHP] regular expression to extract from the middle of a string

2006-07-14 Thread Kim Christensen
On 7/14/06, Steve Turnbull <[EMAIL PROTECTED]> wrote: I have a string similar to the following; cn=emailadmin,ou=services,dc=domain,dc=net I want to extract whatever falls between the 'cn=' and the following comma - in this case 'emailadmin'. $pattern= "/[^=]+=([^,]+)/"; preg_match($pattern,

Re: [PHP] regular expression to extract from the middle of a string

2006-07-14 Thread tg-php
I believe someone gave the regex code for it already, but if you wanted to do it the clumsy way (for those of us who are regex challenged still) here's an alternative: $str = "cn=emailadmin,ou=services,dc=domain,dc=net"; $argsarray = explode(",", $str); foreach ($argsarray as $argstr) { list

Re: [PHP] regular expression to extract from the middle of a string

2006-07-14 Thread Dave Goodchild
On 14/07/06, Steve Turnbull <[EMAIL PROTECTED]> wrote: Hey folks I don't want to "just get you to do the work", but I have so far tried in vain to achieve something... I have a string similar to the following; cn=emailadmin,ou=services,dc=domain,dc=net I want to extract whatever falls betwee

[PHP] regular expression to extract from the middle of a string

2006-07-14 Thread Steve Turnbull
Hey folks I don't want to "just get you to do the work", but I have so far tried in vain to achieve something... I have a string similar to the following; cn=emailadmin,ou=services,dc=domain,dc=net I want to extract whatever falls between the 'cn=' and the following comma - in this case 'emaila