|
Posted by gfrith on 02/09/07 08:19
On Feb 6, 1:46 pm, Michael Fesser <neti...@gmx.de> wrote:
> .oO(gfr...@gmail.com)
>
>
>
> >I want to match on all strings which end _id, but not those ending
> >row_id.
>
> >Some sample strings:
>
> >row_id
> >parent_id
> >person_id
> >person
>
> >I'd like to match all but the 1st and last.
>
> >I've tried many variants, including
>
> >preg_match('/(row)\w{0}_id$/',$subject);
> >preg_match('/(row){0}_id$/',$subject);
> >preg_match('/(?!row)_id$/',$subject);
>
> The last one was very close:
>
> preg_match('/(?<!row)_id$/', $subject);
>
> Notice the '<' to make it a negative look-behind assertion instead of
> negative look-ahead.
>
> Micha
That did the trick, thanks Micha!
[Back to original message]
|