0

hi all, recently ran into a really hard problem for me:

i have an sql command with something like this

SELECT xxxxx FROM xxxxxx WHERE filter LIKE '[A]'

what i would like to do is substitute [ with [[] on the condition that it is after a LIKE and is within " ' " and " ' " directly after the like. regex comes to mind, but i really don't know how to start.

i obviously can't use string.replace because there's that condition that i need to meet.

what i would like to specify is that when i find a LIKE operator, look for two " ' ", if they are found, look between them to find [, if it is found, replace it with [[].

will this be possible? or can someone suggest a brighter idea.

thanks.

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by LizR
0

well i think all you want is a replace command and you don't have to use regex...well here's a SQL replace query to substitute part of field data:
update emp set department='Marketing' where department='Sales'

0

no i can't use a replace command since i'm not replace every [. i only want to replace those coming after like.

going back to using regex, can you give me an example on how it is done? i'm not really sure where to start as i'm not really familiar with it.

thanks in advance.

0

Well. As you havent even shown any signs of trying - read the regex help, show some code, you tell us what you have and how its not doing what you want, then we'll try and steer you in the right direction.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.