+ 1
mix random with regiar expiession
good morning if i wanna to mix random with regiar expiession like the key of program ex: random of ( ^(\d{3})\w-\d\w\d\d-\d\w\w\w-\d\d\w\d$ ) 374G-3H98-3NLN-37J9 how i can mix it to gether
10 odpowiedzi
+ 5
Do you mean to randomly create string, that will match regexp?
+ 3
Try to create key chunk by chunk then concatenate they with '-'
+ 3
@Ahmad answering previous question. Chunk == part.
+ 2
It is hard to imagine and probably hard to release. It is not good idea
+ 1
Here's my code:
https://code.sololearn.com/cG47nRp54Jna/?ref=app
Known issues? Zero looks like the letter O.
+ 1
no ,, the max value is never reach in Random for that you have to add one for it if you want random to get it Xan
0
thx @Xan its helpfull
you need to set Char = (char)rnd.Next(48, 58); for 0 => 9 https://code.sololearn.com/cDwIQOWLVWDm/#cs
!!!!!!!!!
but what i need is regular expression with random "" not gust for Key ""
!!!!!!!!!
0
@Rull Deef yes and what is chunk
0
oke thx
@Rull Deef
0
Ahmad Akil No you don't HAVE to. My code works. There's rarely only one way to do something. 'A' resolves to 48 anyway, and is better!