[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Tue Aug 3 12:52:36 2004 -->
- <!--x-from-r13: syrgpu ng culqrnhk.bet (Tyrgpu) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Using Expect.pm -->
- <li><em>date</em>: Tue Aug 3 12:52:36 2004</li>
- <li><em>from</em>: fletch at phydeaux.org (Fletch)</li>
- <li><em>in-reply-to</em>: <<a href="msg00083.html">[email protected]</a>> (Christopher Fowler's message of "03 Aug 2004 12:24:21 -0400")</li>
- <li><em>references</em>: <<a href="msg00083.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] Using Expect.pm</li>
[...]
Christopher> It no longer croaks but then no longer works. I do
Christopher> not get anything in $@ afterwards. I need a way to
Christopher> validate the regex and if it is invalid remove it
Christopher> from the @search list.
my @re = qw( a.b cd? ?bad go{2}d );
my @valid;
for( 0..$#re ) {
eval qq{qr/$re[$_]/};
if( $@ ) {
warn "Problem with re $_:\n$@"
} else {
push @valid, qr/$re[$_]/
}
}
Or more succinctly (but without the warnings):
my @re = qw( a.b cd? ?bad go{2}d );
my @valid = grep eval qq{qr/$_/}, @re;
--
Fletch | "If you find my answers frightening, __`'/|
fletch at phydeaux.org | Vincent, you should cease askin' \ o.O'
| scary questions." -- Jules =(___)=
| U
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00087" href="msg00087.html">[ale] Using Expect.pm</a></strong>
<ul><li><em>From:</em> esoteric at 3times25.net (Geoffrey)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00083" href="msg00083.html">[ale] Using Expect.pm</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00083.html">[ale] Using Expect.pm</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00085.html">[ale] Network Virus?</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00083.html">[ale] Using Expect.pm</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00087.html">[ale] Using Expect.pm</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00084"><strong>Date</strong></a></li>
<li><a href="threads.html#00084"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>