Re: Need help with Perl regex

From: Joe Smith (joe_at_inwap.com)
Date: 01/07/05


Date: Fri, 07 Jan 2005 01:58:07 -0800

surfking wrote:
> I found this line of code
> which was parsing the /etc/termcap file located on a UNIX system.
>
> if (/(^|\|)${term}[:\|]/) {
>
> format of entries in the /etc/termcap file, I don't see how this pattern
> is successfull. Can anyone out there give me some ideas on this ?

It's designed to match entries like this:

ibmpcx|xenix|ibmx|IBM PC xenix console display:

For $term = 'ibmpcx', /^$term[|]/ matches.
For $term = 'xenix', /\|$term[|]/ matches. Same for 'ibmx'.
For $term = 'IBM PC xenix console display', /\|$term[:]/ matches.
For entries that have no aliases, /^$term[:]/ matches.

        -Joe