Matthew Whipple schreef: > Dr.Ruud: >> Tatiana Lloret Iglesias: >>> What regular expression do I need to convert Version: 1.2.3 to >>> Version: >>> 1.2.4 ? >>> >>> I.e. my pattern is Version: number.number.number and from that i >>> need Version: number.number.number+1 >>> After the : i can have a space or not... >>> >> >> Why use a regex? >> >> perl -wle ' >> $v = 2.1.1; >> printf "%vd\n", $v; >> substr $v, -1, 1, chr ord(substr $v, -1, 1) + 1; >> printf "%vd\n", $v >> ' >> >> See also version.pm > > This wouldn't scale past double digits.
Why not? $ perl -wle ' $v = 1.23456.777888999; printf "%vd\n", $v; substr $v, -1, 1, chr ord(substr $v, -1, 1) + 1; substr $v, -2, 1, chr ord(substr $v, -2, 1) + 1; printf "%vd\n", $v ' 1.23456.777888999 1.23457.777889000 -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/