Dear Ted,

thank you for answering so quickly. 

The problem is, I don't want to make the users write
regular expressions. Of course, I have to test them with
the help of 'eval' in order to prevent that an illegal
regular expression is blocking the whole cgi-application.

The reason for not using regular expressions is that
my search application is meant for searching patterns in
a bilingual text (German and Russion), which is displayed
in cyrillic and with German umlauts. And it would be a lot
easier if I could just search for

   sun moon AND NOT suns moons

So, I appreciate all ideas.

Peter

-----------------------------------

Zitat von [EMAIL PROTECTED]:

> perlfaq6: (cut-n-paste to get the final "-" there)
>
http://www.perldoc.com/perl5.8.0/pod/perlfaq6.html#How-do-I-match-a-pattern-that-is-supplied-by-the-user-
> 
> How do I match a pattern that is supplied by the user? 
> Well, if it's really a pattern, then just use 
> 
>     chomp($pattern = <STDIN>);
>     if ($line =~ /$pattern/) { }  
> 
> Alternatively, since you have no guarantee that your user entered a valid
> regular expression, trap the exception this way: 
> 
>     if (eval { $line =~ /$pattern/ }) { }  
> 
[...]
> Good luck,
> .ted

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to