Re: [PHP] Getting part of string matched with regular expressions

2008-01-28 Thread Jim Lucas
Teck wrote: Hi, I'm trying to find a way to get part of a string where the part is matched with regular expressions. So, for example, if I have a string: a2b3cd5ef6ghi7232jklmn I need to grab "12b3cd5" using regular expressions and store the part in a variable. how do you decide what th

Re: [PHP] Getting part of string matched with regular expressions

2008-01-28 Thread Per Jessen
Teck wrote: > I'm trying to find a way to get part of a string where the part is > matched with regular expressions. > > So, for example, if I have a string: > > a2b3cd5ef6ghi7232jklmn > > I need to grab "12b3cd5" using regular expressions and store the part > in a variable. Assuming you meant

Re: [PHP] Getting part of string matched with regular expressions

2008-01-28 Thread Jochem Maas
Teck schreef: Hi, I'm trying to find a way to get part of a string where the part is matched with regular expressions. So, for example, if I have a string: a2b3cd5ef6ghi7232jklmn I need to grab "12b3cd5" using regular expressions and store the part in a variable. what are the rules for

Re: [PHP] Getting part of string matched with regular expressions

2008-01-27 Thread Paul Scott
On Mon, 2008-01-28 at 14:28 +0900, Teck wrote: > I was using preg_replace for this, and try to delete (i.e., replace > the non-matched part with an empty string) the second part, but I > can't make it work. Rather use preg_match_all() as that will produce an array of values, with the first va

[PHP] Getting part of string matched with regular expressions

2008-01-27 Thread Teck
Hi, I'm trying to find a way to get part of a string where the part is matched with regular expressions. So, for example, if I have a string: a2b3cd5ef6ghi7232jklmn I need to grab "12b3cd5" using regular expressions and store the part in a variable. $var = do_something("","","a2b3cd5ef