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';

[PHP] problem with preg_replace

2004-01-13 Thread Gregor Jaksa
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'; replacing those words is easy i just use preg_replace('/\b( ' . $words .

[PHP] Problem with preg_replace

2001-07-21 Thread James Bogosian
Currently, I am parseing a string for href tags and adding a "target=_blank" to them to have them open up in a new window using this: $body = preg_replace("<[aA] [hH][rR][eE][fF]=\"(.*?)\">", 'a href="$1" target=_blank', $row->body); This works, to the best of my knowledge, however I was curious