Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please guide me on writing the regex.

 
kc pradeep
Greenhorn
Posts: 29
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a requirement to replace each ValidDuring('01/18/2011..06/16/2011') in the where condition with (1=1),

So if the query is SELECT * FROM ABCD WHERE ((ValidDuring('2010',date)) and (a>b)) or ValidDuring('01/18/2011..06/16/2011')

then it should be changed to

SELECT * FROM ABCD WHERE ((1=1)and(a>b)) or (1=1)

PS. there are two way of giving input for ValidDuring.

Please let me know how to write a efficient Regex for the same
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming the first parameter starts with a single quote, and there are no nested parentheses:
 
kc pradeep
Greenhorn
Posts: 29
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not giving the correct result, I checked in the site RegExr
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kc pradeep wrote:This is not giving the correct result, I checked in the site RegExr


Darryl's solution seems to have lost some escaping of the parenthesis.


Maybe when he cut-and-pasted it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic