aspose file tools*
The moose likes Beginning Java and the fly likes Please guide me on writing the regex. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Please guide me on writing the regex." Watch "Please guide me on writing the regex." New topic
Author

Please guide me on writing the regex.

kc pradeep
Greenhorn

Joined: Mar 05, 2011
Posts: 28

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


OCPJP 6
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4544
    
    5

Assuming the first parameter starts with a single quote, and there are no nested parentheses:


luck, db
There are no new questions, but there may be new answers.
kc pradeep
Greenhorn

Joined: Mar 05, 2011
Posts: 28

This is not giving the correct result, I checked in the site RegExr
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

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.


Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please guide me on writing the regex.