P
Perl Learner
Okay, I know there should be something in perl that lets me do this,
but I tried all kinds of google search but ended up with normal pattern
matching.
My problem is .. i have a bunch of names.. in fact, 500 of those.. and
i want to put them in groups...
for example:
INVX1
INVX2
...
...
INVXLH
INVLH
CLKINV2X1
CLKINV
...
...
NAND2X2
NAND2X4
...
...
NANDSOMETHINGELSE
...
...
AND_OTHER_GROUPS
What I would like to do is match all "INV"s .. and match all "NAND"s
...etc
I know you can match all "INVs" by doing /^INV/ .. but that's not what
I meant..
I want it to read all INV*** and come up with INV (most common
starting name)
(Notice some names have INVX* and one name has just INVLH .. so the
most common is INV) .. name case with NANDs and other "groups"
The problem is that I dont know how long this "root name" could be (for
INVs it is only 3, for NANDs, it is 4.. it all depends on the list of
names given), if i knew the length, the problem would be much simpler.
Is there a function in perl that can match the longest "root name"
possible?
If there isn't one, I have to write it myself. But if there is, i'd be
glad if someone points me to it.
but I tried all kinds of google search but ended up with normal pattern
matching.
My problem is .. i have a bunch of names.. in fact, 500 of those.. and
i want to put them in groups...
for example:
INVX1
INVX2
...
...
INVXLH
INVLH
CLKINV2X1
CLKINV
...
...
NAND2X2
NAND2X4
...
...
NANDSOMETHINGELSE
...
...
AND_OTHER_GROUPS
What I would like to do is match all "INV"s .. and match all "NAND"s
...etc
I know you can match all "INVs" by doing /^INV/ .. but that's not what
I meant..
I want it to read all INV*** and come up with INV (most common
starting name)
(Notice some names have INVX* and one name has just INVLH .. so the
most common is INV) .. name case with NANDs and other "groups"
The problem is that I dont know how long this "root name" could be (for
INVs it is only 3, for NANDs, it is 4.. it all depends on the list of
names given), if i knew the length, the problem would be much simpler.
Is there a function in perl that can match the longest "root name"
possible?
If there isn't one, I have to write it myself. But if there is, i'd be
glad if someone points me to it.