http://www.perlmonks.org?node_id=1176775

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I looking for a regular expression: I want to search for a sign(x), followed by a number n of any signs, followed by x, followed by the SAME number n of any signs, followed by x

the sign x of course is also allowed for the "any" signs

VAILD for example is :

xxx x.x.x x12x..x x123x...x x123x.x.x

NOT VALID for example (not the same number of signs between x)

x12x1x

A way would be to code every case. But this is not a smart way!

/(xxx)|(x..x..x)|(x...x...x)|(x.{4}x.{4}x)/

Follwoing is not working, because it would find the term x12x1x (not the same number of signs between x)

/x.{0,50}x.{0,50}x/

Many Thanks for any suggestion !