• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Please guide me on writing the regex.

 
Greenhorn
Posts: 29
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is not giving the correct result, I checked in the site RegExr
 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic