Re: [PHP] problem with preg_replace

2004-01-13 Thread Manuel Vázquez Acosta
> > $new_file = > preg_replace('/\b(? > ' [tag]$1[/tag] ', $new_file); > > Replace the \w+ by [a-bA-Z]+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] problem with preg_replace

2004-01-13 Thread Gregor Jaksa
Thx Erik, it works great except for one detail. It matches numbers too. Can you fix it so it matches only words please ? For example: $file = 'this is a number 1231 test.'; $words = 'test|number'; Result: [tag]this[/tag] [tag]is[/tag] [tag]a[/tag] [tag]nu[/tag] [sample]number[/sample] [tag]1231[/t

Re: [PHP] problem with preg_replace

2004-01-13 Thread memoimyself
Hello Gregor, On 13 Jan 2004 at 15:08, Gregor Jaksa wrote: > hello, i need to replace some words in file with [tag]word[/tag] and other > words with [sample]word[/sample]. > > i have a list of words which i need to replace with [sample] tags declared > like > $words = 'word1|word2|word3|word4';