Re: preg_replace in update statement

2012-03-10 Thread Hal�sz S�ndor
2012/03/08 16:11 -0500, Hank I have a varchar field in the database, and I want to remove all text between WordA and WordB, including WordA and WordB, leaving all text before WordA and after WordB intact. Possible with just SQL? I know I can write a PHP program to do it, but it's not th

RE: preg_replace in update statement

2012-03-09 Thread David Lerer
Try with a combination of functions LOCATE and SUBSTR. Locate will return the positions for WordA and WordB within the original text, and, SUBSTR will allow you to string what you you need all together. David. On Thu, Mar 8, 2012 at 4:11 PM, Hank wrote: > I have a simple problem: > > I have a

Re: preg_replace in update statement

2012-03-09 Thread Baron Schwartz
You may find this helpful: http://www.mysqludf.org/lib_mysqludf_preg/ On Thu, Mar 8, 2012 at 4:11 PM, Hank wrote: > I have a simple problem: > > I have a varchar field in the database, and I want to remove all text > between WordA and WordB, including WordA and WordB, leaving all text > before Wo

Re: preg_replace in update statement

2012-03-08 Thread Hank
They are regular words. I was hoping someone would already know how to do it. I was trying to avoid rolling my own solution using the string functions. It gets really messy, really quick. -Hank On Thu, Mar 8, 2012 at 8:18 PM, Michael Dykman wrote: > If your words need to be regular expressio

preg_replace in update statement

2012-03-08 Thread Hank
I have a simple problem: I have a varchar field in the database, and I want to remove all text between WordA and WordB, including WordA and WordB, leaving all text before WordA and after WordB intact. Possible with just SQL? I know I can write a PHP program to do it, but it's not that important