PHP Developers Network
http://forums.devnetwork.net/

Need help with preg replace
http://forums.devnetwork.net/viewtopic.php?f=38&t=143359
Page 1 of 1

Author:  MickDDD [ Sun Feb 12, 2017 6:14 pm ]
Post subject:  Need help with preg replace

Hi All, thanks for having me on your forums...

I have a quite in depth script that uses allot of PREG replace to output what I need.

The only problem is that i need some stop words (omitted words) from the preg replace but I dont know how to do it.

This is the code

Syntax: [ Download ] [ Hide ]
$dataa = preg_replace('/(\b.{1,2}\s)/',',',$dataa);


it basically removes all 2 letter and smaller words from my string.

But I need it to keep the word

Syntax: [ Download ] [ Hide ]
St


Thank you

Author:  Celauran [ Sun Feb 12, 2017 9:15 pm ]
Post subject:  Re: Need help with preg replace

What about a negative lookahead?

http://rubular.com/r/NkzLPlN1PA

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/