amonotod has asked for the wisdom of the Perl Monks concerning the following question:
$buffer =~ s/varchar \(\d+\)/TEXT/ig if (/varchar \(\d+\)/i and $1 > 255);
Obviously, I want to change any VARCHARs in my table declaration to TEXT if they have a length over 255. This is necessary to support an older Sybase...
Thank you,
amonotod
UPDATE
The code from bgreenlee has helped me, greatly. Thank you!
$bar =~ s/varchar\s*\((\d+)(??{$1<256})\)/TEXT/i;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: String replacement with regex...
by bgreenlee (Friar) on Aug 06, 2004 at 15:05 UTC | |
by Gilimanjaro (Hermit) on Aug 06, 2004 at 15:24 UTC | |
by Eimi Metamorphoumai (Deacon) on Aug 06, 2004 at 16:05 UTC | |
by Gilimanjaro (Hermit) on Aug 09, 2004 at 09:40 UTC | |
by amonotod (Acolyte) on Aug 06, 2004 at 16:15 UTC | |
by bgreenlee (Friar) on Aug 06, 2004 at 19:58 UTC | |
|
Re: String replacement with regex...
by bart (Canon) on Aug 07, 2004 at 09:15 UTC | |
|
Re: String replacement with regex...
by ishnid (Monk) on Aug 06, 2004 at 15:04 UTC | |
by Eimi Metamorphoumai (Deacon) on Aug 06, 2004 at 15:32 UTC |