From: Ralph Shnelvar Date: 2009-11-09T20:39:45+09:00 Subject: Re: Regexp: getting the first found Ahmad, Newbie here so take what I have to say with a grain of salt. Your pattern is "greedy". To turn it into a lazy pattern add a question mark thusly ... /<<(.*)\/Filter(.*?)>>/ (untested) Ralph Monday, November 9, 2009, 2:43:12 AM, you wrote: AA> Hello, AA> I'm having some problem comprehending the regexp for my current need. AA> Example input (2 scenario): AA> 1. AA> << AA> /Filter AA> /FlateDecode AA> /Length 4169 >>> AA> stream AA> blablabla AA> endstream AA> << >> AA> 2. AA> <> AA> stream AA> blablabla AA> endstream AA> << >> AA> I've trying to get the string after the string /Filter and the first seen ">>>" by using this regexp: /<<(.*)\/Filter(.*)>>/im AA> The problem is that, there is two >> in the input and the regexp takes until the last >>> it detected. How can I make it to get only until the first >>> that it detects ? AA> Thank you in advance -- Best regards, Ralph mailto:ralphs@dos32.com