in reply to Searching for a specific pattern.
if( $type eq 'LX' ) { [download]
I don't see the relation between XPaths and regular expressions, but /^LX\z/ checks for exactly "LX".
( An XPath that checks the value of an attribute would look like /foo/bar[@type="LX"] )