Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex to check for the same digit in the variable

Status
Not open for further replies.

new2unix

Programmer
Feb 5, 2001
143
US
Hi,

Is there a regex that will allow me to check the same digit in a variable?

0
0000
11
111
2222
22222
.
.
.
999
999999
99999999

Basically, if the variable contains only the same digit repeating an unknown number of times, the IF regex logic should return true. The only thing I could think of right now is I probably need to do the checking for each digit separately.

Thanks

Mike
 
Hi,

Do you mean, that the file format is like this ...
0
00
111
4
5555
3
777
2222
7
and so on.

And, now you should get result false for 0,4,3,7 and true for rest of the cases as numbers are repeating !

if that's not what you are looking for, then please reply with a bit more detail explaination.

regards,
Mahesh

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top