My most involved SoloLearn code yet, the RegEx generator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

My most involved SoloLearn code yet, the RegEx generator

I implemented a class, which represents a "system of RegEx equations" and has a method to solve that system. This code uses it to construct RegEx, which match base b string representations of numbers n, such that n%q=r for user defined b,q,r. With b=2, q=3, r=0, we get the RegEx (0*1(01*0)*1)*0* which will match all binary numbers divisible by 3, like 1001 (which is 9), but not 100 (which is 4). https://code.sololearn.com/c7LXmfGbu02U

16th May 2017, 7:51 AM
Tob
Tob - avatar
3 Answers
+ 6
Wow you rock
16th May 2017, 8:00 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 6
If you want to know how or why this works, but don't have a solid background in computer science (yet ;), take a look at this blog entry, it is almost beginner friendly, but you still need some knowledge in the field: https://michaellevet.wordpress.com/2015/04/22/automata-theory-brzozowski-algebraic-method/ If that does not help you all too much and/or you want to learn more, I will be very happy to explain a thing or two.
16th May 2017, 8:01 AM
Tob
Tob - avatar
+ 2
So cool....... Bro
16th May 2017, 8:31 AM
Vishnu ks
Vishnu ks - avatar