|
From: Roland G. <RGi...@a1...> - 2001-11-26 09:52:11
|
> I'm doing some mulitline matching of an FTP prompt and I'm having
> trouble with a colon (:) in my regex.
No, you have troubles with backslashes...
> unless ( $pattern = $ftp->expect($timeout, '-re',
"550 $list/archive/latest/\*:", "226 Transfer complete.\r\nftp> " )){
Well, if I would be a perl parser, I would think: "Hmm, a string in
double quotes... OK, let's substitute... a '$' means a variable
substitution... oh, there is a backslash, OK, let's quote the next
character, but it isn't a special character, so I just remove the
backslash". And later, the regexp engine thinks: "Let's see, it
matched everything so far, the next character should be a slash that
can occur zero or any number of times... OK, there is one slash... next
charcter shoudl be a colon... nope, there is an asterisk there, sorry,
no match!".
I'd suggest you use qr() or double that backslash.
> I don't know where the ^M come from. No doubt, because I am
> running cygwin.
Maybe, but that could also be just missing CRLF->LF translation in the
pty, which is system dependent, so yes, it's Cygwin.
> So, it apppears the colon is the problem. But wait! the
> after-match string still has the asterisk. I escaped the
> asterisk. Do I have to double-escape it?
Yes.
> --
> Greg Matheson The best jokes are
> Chinmin College those you play on
> yourself.
^ does the above one count? :-)
Hope this helps,
Roland
--
RGi...@cp...
|