Paulie 26 Posted September 29, 2007 (edited) I just "Stumbled Upon" this Regular Expression that seems to be able to tell if a number is prime.I piped it into autoit, and it seems to work!Unfortunately, due to my limited knowledge of StringRegExp, I find myself unable to understand exactly how it works, and i was wondering if one of the RegExp Gurus here could give me an explanation of the logic behind it.Func _IsPrime($Integer) $String = "" For $i = 1 to Number($Integer) $String&="1" Next If Not StringRegExp($String,"^1?$|^(11+?)\1+$") Then Return 1 Else Return 0 EndIf EndFunc Edited September 29, 2007 by Paulie Share this post Link to post Share on other sites
Paulie 26 Posted September 29, 2007 I have a feeling that i have managed to fugure at least the vast majority of this one out by myself. Now that i understand the concept of "Backtracking" it all makes sense. Thanks Share this post Link to post Share on other sites