I know this is kind of late but I didn't see any replies posted. You're right that RE's don't do arithmetic so I would break it down into categories.
1) 4 digits or greater, i.e. 1000 and up RE re1 = new RE("NVARCHAR\([0-9]{4,}\)"); //you can also substitute the posix character class [:digit:] for [0-9] 2) 3 digits with first digit greater than 2, i.e. 300 - 999 RE re2 = new RE("NVARCHAR\([3-9][0-9]{2}\)"); 3) 3 digits with first digit = 2 and 2nd digit greater than 5, i.e. 260 - 299 RE re3 = new RE("NVARCHAR\(2[6-9][0-9]\)"); 4) 3 digits with first two digits = 25 and last digit greater than 5, i.e. 256 - 259 RE re4 = new RE("NVARCHAR\(25[6-9]\)"); You could either do this in four passes or in one pass with the following combined RE: RE re = new RE("NVARCHAR\(([0-9]{4,})|([3-9][0-9]{2})|(2[6-9][0-9])|(25[6-9])\)"); For readability you could break up the preceding as: String pattern1000_up = "([0-9]{4,})"; String pattern300_999 = "([3-9][0-9]{2})"; String pattern260_299 = "(2[6-9][0-9])"; String pattern256_259 = "(25[6-9])"; RE re = new RE("NVARCHAR\(" + pattern1000_up + "|" + pattern300_999 + "|" + pattern260_299 + "|" + pattern256_299 + "\)"); Then do a substitution. e.g. re.subst(input, "TEXT"); //input = line of sql read in /Sam -----Original Message----- From: jfina [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 2:31 AM To: [EMAIL PROTECTED] Subject: Arithmetic ? Since it seems like regexp is lacking arithmetic functions i'm not sure if the following is possible: Converting a database sql file (structure) i need to replace all NVARCHAR(...)'s greater than 255 to TEXT. (e.g. NVARCHAR(4000) -> TEXT) Any ideas? /Jon -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> ******************************************************************** The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please re-send this communication to the sender and delete the original message or any copy of it from your computer system. Thank You. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>