Nothing like that comes to mind. If it has to be something that is in the predefined match, most of your examples wouldn't do that. If it's just to be a heuristic to help you throw out something, it would depend on the heuristic.<div>
<br></div><div>Personally, I'd probably use a tied hash or maybe MongoDB or something similar, fill that with the list and then hit the database for a verification. The database "hash table" could be reloaded every week.</div>
<div><br></div><div>This is old school, but it works quite well for this simple task:</div><div><br></div><div># Common Code</div><div>use DB_File;</div><div>tie %valid,  'DB_File', 'valid_things.db', O_RDWR|O_CREAT, 0644, $DB_HASH;</div>
<div><br></div><div># Load the latest (assuming the input is one valid string per line)</div><div>%valid = ();</div><div>while (<>) { chomp; $valid{$_}++ }</div><div><br></div><div># Check for valid strings</div><div>
if ($valid{ $unvalidated_input }) { print "YES!\n" }</div><div>else { print "NO!\n" }</div><div><br></div><div><div class="gmail_quote"><br></div><div class="gmail_quote">2011/9/29 Dan Linder <span dir="ltr"><<a href="mailto:dan@linder.org">dan@linder.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I have a list of server names that I want to create a regex match against.  It could be done by hand, but the list changes (adds, removes) on a weekly basis.<div>
<br></div><div>Does anyone know of a program that can take a list of matches and create a regular expression that will match them?</div>

<div><br></div><div>Example:</div><div>OMAWWW001</div><div>OMAWWW002</div><div>OMADNS001</div><div>ORDWWW001</div><div><div>ORDWWW002</div></div><div><div>ORDWWW003</div></div><div>ORDDNS001</div><div>ORDDNS002</div><div>


<br></div><div>I guess the "shortest" match would be /O.......[123]/ but it's kinda 'loose'.</div><div><br></div><div>I *think* what I'd like is something like this: /O[MR][AD][WD][WN][WS]00[123]/</div>


<div>(But a smarter regex tool might find something tighter...)</div><div><br></div><div>What I *don't* want is: /OMAWWW001|OMAWWW002|...|ORDDNS002/</div><div>I don't have enough space in my tool for a 10K long string! :)</div>


<div><br></div><div>Any thoughts?</div><div><br></div><div>Thanks,</div><div>DanL<br clear="all"><font color="#888888"><div><br></div>-- <br>***************** ************* *********** ******* ***** *** **<br>"Quis custodiet ipsos custodes?"<br>


    (Who can watch the watchmen?)<br>    -- from the Satires of Juvenal<br>"I do not fear computers, I fear the lack of them."<br>    -- Isaac Asimov (Author)<br>** *** ***** ******* *********** ************* *****************<br>



</font></div>
<br>_______________________________________________<br>
Omaha-pm mailing list<br>
<a href="mailto:Omaha-pm@pm.org">Omaha-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/omaha-pm" target="_blank">http://mail.pm.org/mailman/listinfo/omaha-pm</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Andrew Sterling Hanenkamp<br><a href="mailto:sterling@hanenkamp.com">sterling@hanenkamp.com</a><br>
785.370.4454<br>
</div>