Page 1 of 1

regex replace

Posted: Mon Aug 01, 2011 8:49 am
by juri
Hello, is it possible to bulk replace "season 4" to "season RANDOM number 1-6" ?
a variable i can use to replace some number to random number ...

thanks

Re: regex replace random numbers

Posted: Mon Aug 01, 2011 10:03 pm
by Fool4UAnyway
The other way around is feasible: replace "random" (= any) numbers by a constant.

Here is a pseudo-random approach which may suit your purposes. Logically, it is not random, but it may appear to be when you do not know it isn't.

You could perform 6 separete replaces for each constant sequence with a varying pre- of suffix.

Find:
([aeiouy].*)season 4

Replace by:
$1season 1

Find:
([bcdfg].*)season 4

Replace by:
$1season 2

etc. You may apply a more strict pre- or suffix, because it is very likely that certain letters will appear in most or all lines, while other may be very scarce.