On Saturday 27 October 2007 21:18, yitzle wrote: > I want to search some text for a user provided string. > I was getting input and escaping it with qr(). I then used the > qr()'ed value as input to my grep. > However, I realized that qr() works too well for my pursposes. I want > the user input to be interpretted as a string literal, not as a > RegEx, ie if the user inputs "[ab]", I want to search for "\[ab\]" - > that exact sequence of characters. > How do I go about searching for a string literal in a bigger block of > text?
Either use index() to search for literal text or use quotemeta to escape regular expression meta-characters. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/