C
championsleeper
i am trying to write a script that will:
- check an integer value to see if it has a particular pattern
(regular expression match)
- tell me what the particular pattern is.
I am searching integer numbers for three digit patterns of the form
111, 222, ..., 999, 000. If the number contains one or more of these
then I want the script to say the pattern I wanty has been matched and
which pattern it has found.
e.g
252352524577778787 -> yes! 777
18357000232333 -> yes! 000
I have written a ksh script to do this but want to write something in
awk or perl that can do the same (better portability). I've been
reading up on regular expressions but to no avail. Ideally I'd like to
do the matching without recourse to a loop which is what I currently
have.
Any ideas?
- check an integer value to see if it has a particular pattern
(regular expression match)
- tell me what the particular pattern is.
I am searching integer numbers for three digit patterns of the form
111, 222, ..., 999, 000. If the number contains one or more of these
then I want the script to say the pattern I wanty has been matched and
which pattern it has found.
e.g
252352524577778787 -> yes! 777
18357000232333 -> yes! 000
I have written a ksh script to do this but want to write something in
awk or perl that can do the same (better portability). I've been
reading up on regular expressions but to no avail. Ideally I'd like to
do the matching without recourse to a loop which is what I currently
have.
Any ideas?