On Fri, 2010-04-23 at 00:44 +0200, Michiel Sikma wrote: > You need to use the multiline modifier. > > Try this: > preg_match_all("/^(\#.*)/im", $my_string, $matches); > print_r($matches); > > The result: > > Array > ( > [0] => Array > ( > [0] => # {{uncountable}} The dried leaves or buds of the [[tea > plant]], > [1] => #: ''Go to the supermarket and buy some '''tea'''.'' > [2] => # {{uncountable}} The drink made by [[infuse|infusing]] > these dried > ) > > [1] => Array > ( > [0] => # {{uncountable}} The dried leaves or buds of the [[tea > plant]], > [1] => #: ''Go to the supermarket and buy some '''tea'''.'' > [2] => # {{uncountable}} The drink made by [[infuse|infusing]] > these dried > ) > > ) > > Michiel > > On 22 April 2010 22:38, saeed ahmed <saeed.sas@xxxxxxxxx> wrote: > > > this is not working > > > > /^(\#.+)$/g > > > > I have tried the preg_match function > > > > ----- > > Regards > > Saeed Ahmed > > http://saeed05.wordpress.com > > ----- > > > > > > On Thu, Apr 22, 2010 at 11:39 PM, Ashley Sheridan > > <ash@xxxxxxxxxxxxxxxxxxxx>wrote: > > > > > On Thu, 2010-04-22 at 23:41 +0600, saeed ahmed wrote: > > > > > > hello friend, > > > > > > I have a string like below > > > " > > > > > > ===Pronunciation=== > > > * {{enPR|tē}}, {{IPA|/tiː/}}, {{SAMPA|/ti:/}} > > > * {{audio|en-us-tea.ogg|Audio (US)}} > > > * {{audio|En-uk-tea.ogg|Audio (UK)}} > > > *: {{rhymes|iː}} > > > * {{homophones|T|te|tee|ti}} > > > > > > > > > # {{uncountable}} The dried leaves or buds of the [[tea plant]], > > > ''[[w:Camellia sinensis|Camellia sinensis]]''. > > > #: ''Go to the supermarket and buy some '''tea'''.'' > > > # {{uncountable}} The drink made by [[infuse|infusing]] these dried > > > leaves or buds in hot water. > > > ====Usage notes==== > > > In the [[United Kingdom]], [[Canada]], other English speaking > > > [[Commonwealth]] countries, and in northern areas of the [[United > > > States]], ''tea'' is assumed to mean [[hot]] tea and is usually served > > > in a [[teapot]] with separate [[cup]]s, or sometimes served directly > > > in cups such as for large groups or for [[takeout]]. > > > > > > In southern areas of the United States, ''tea'' is assumed to mean > > > [[iced tea]] and is usually served with ice, either in a [[pitcher]] > > > with separate [[glass]]es or directly in glasses. > > > > > > Strictly speaking, "tea" has been reserved for [[infusion]]s made from > > > leaves of ''[[w:Camellia sinensis|Camellia sinensis]]''. Infusions > > > made from other [[herb]]s such as [[rooibos]], [[mint]]{{,}} and > > > [[chamomile]] are called [[tisane]]s. In recent years the word "tea" > > > has been extended to include the herbal infusions. > > > > > > ====Synonyms==== > > > * {{italbrac-colon|dried leaves of tea plant}} [[tea leaves]] > > > * {{italbrac-colon|drink made by infusing parts of various other > > > plants}} [[herb tea]], [[herbal tea]], [[infusion]], [[tisane]] > > > > > > ====Derived terms==== > > > > > > " > > > > > > now I want to collect only the string which are start with '#'. how > > > can I do this? please suggest me. > > > > > > > > > ----- > > > Regards > > > Saeed Ahmedhttp://saeed05.wordpress.com > > > ----- > > > > > > > > > If the text is in a file, use file() to read the contents into an array > > and > > > then check the first character. > > > > > > Alternatively, if the text is in a string, you could use a regex to pull > > > out only matching lines. This is an untested regex, but it should do the > > > trick: > > > > > > /^(\#.+)$/g > > > > > > Thanks, > > > Ash > > > http://www.ashleysheridan.co.uk > > > > > > > > > > > Ah, ignore my last reply then! I used the g modifier, forgetting it wasn't the multi-line one in PHP! Thanks, Ash http://www.ashleysheridan.co.uk