Tintware Documentation : Tint Programming Language : Tint Reference : Ports and Processes : port.regex-matchSyntax#(%port.regex-match,%regex) #(%port.regex-match,%regex,%notfound) #(%port.regex-match,%regex,%notfound,%timeout) #(%port.regex-match,%regex,%notfound,%timeout,%lookahead) %port is any port. %regex is the name of a regular expression object used to match against the characters available from the port. %notfound is what should be returned if a match is not found or the timeout occurs. %timeout is how long to wait in seconds for enough characters to be available. %lookahead is how far Tint should look ahead for characters which match. Using %timeout and %lookahead is necessary to constrain matching, otherwise, Tint will keep looking ahead for a match until memory is exhausted for the port is closed from the other side. Example#(regex,a-regex,((\cM|\cJ)+)) #(def,p,#(tint.socket)) #(#(p).connect,sourceforge.org,80) #(#(p).put,GET / HTTP/1.1#(tint.byte,10)#(tint.byte,10)) #(#(p).regex-match,a-regex) HTTP/1.1 400 Bad Request #(#(p).regex-match,a-regex) Date: Tue, 27 Nov 2001 #(#(p).regex-match,a-regex) Apache/1.3.19 (Unix) #(#(p).close) |