If such a regex exists, the regex is a finite automaton. So what it will do is accept strings of length that is a square number.
Such an automata does not exist.
Quote:It can be proven that no finite automaton can recognize this language. Intuitively, the idea behind the proof is that any such automaton would have to count an arbitrary number of 1's, say m of them and check that m is a perfect square. Not machine with a finite number of states can do this for arbitrarily large m. Although a finite automaton is not up to the job, a Turing machine can be designed to recognize this language.
Quote was taken from here.
The following is quoted from here although the article describes a way to build a 4-band Turing machine that accepts square length strings. A set which cannot be accepted by pushdown machines (this is shown in the material on formal languages) is the set of strings whose length is a perfect square. In symbols this is: {a^n | n is a perfect square }.
In reply to Re: check for square-number with a regex
by Anonymous Monk
in thread check for square-number with a regex
by Ratazong
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |