regex replace

Tool for Search and Replace across multiple files.
User avatar
juri

regex replace

Post 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
User avatar
Fool4UAnyway

Re: regex replace random numbers

Post 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.
Post Reply