mix random with regiar expiession | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

12th Apr 2018, 7:22 AM
Ahmad Akil
Ahmad Akil - avatar
10 Answers
+ 5
Do you mean to randomly create string, that will match regexp?
12th Apr 2018, 9:58 AM
Rull Deef 🐺
Rull Deef 🐺 - avatar
+ 3
Try to create key chunk by chunk then concatenate they with '-'
12th Apr 2018, 9:53 AM
Rull Deef 🐺
Rull Deef 🐺 - avatar
+ 3
@Ahmad answering previous question. Chunk == part.
12th Apr 2018, 5:04 PM
Rull Deef 🐺
Rull Deef 🐺 - avatar
+ 2
It is hard to imagine and probably hard to release. It is not good idea
12th Apr 2018, 5:00 PM
Rull Deef 🐺
Rull Deef 🐺 - avatar
+ 1
Here's my code: https://code.sololearn.com/cG47nRp54Jna/?ref=app Known issues? Zero looks like the letter O.
12th Apr 2018, 9:54 AM
Emma
+ 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
12th Apr 2018, 6:47 PM
Ahmad Akil
Ahmad Akil - avatar
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 "" !!!!!!!!!
12th Apr 2018, 4:57 PM
Ahmad Akil
Ahmad Akil - avatar
0
@Rull Deef yes and what is chunk
12th Apr 2018, 4:59 PM
Ahmad Akil
Ahmad Akil - avatar
0
oke thx @Rull Deef
12th Apr 2018, 5:03 PM
Ahmad Akil
Ahmad Akil - avatar
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!
12th Apr 2018, 5:17 PM
Emma