Path: news.daimi.aau.dk!jlk From: jlk@daimi.aau.dk (J|rgen Lindskov Knudsen) Newsgroups: comp.lang.beta Subject: Re: Question about regexpr. Date: 22 Jun 1995 12:04:53 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 56 Message-ID: <3sbm95$lcv@belfort.daimi.aau.dk> References: <3s8pmc$ou2@belfort.daimi.aau.dk> Reply-To: jlknudsen@daimi.aau.dk (Jorgen Lindskov Knudsen) NNTP-Posting-Host: lithium.daimi.aau.dk In <3s8pmc$ou2@belfort.daimi.aau.dk> Thus spake Thomas Rosanski : >Hello, I have tryed to use the regexp library, but I had some problem. >ORIGIN '~beta/basiclib/current/regexp' >---program:descriptor--- >(# something: ^text; > do > Loop: > (# do getLine -> something[]; > (if 'Test:'->something.regexp_match > then 'Yes, I found Test: at the Beginning of > the line' -> putLine; > else '.' -> put; > if); > restart Loop > #) >#) >So, I wanted to search the input stream (something that comes throug >a Unix pipe | ) and I wanted to find a line that starts with "Test:". >But it doesn't work. >I also tryed to use virtuell binding, but it seems that the do part >was not executed. >(I used the following line to test myprog: >cat textfile | myprog >where textfile is a file with several lines, one contains "Test: this is it" >and myprog is the executable file, compiled from the above example) I suspect your problem is, that you don't set the position of 'something' to the beginning (you don't give too many hints as to how it don't work :-). Please try: (# something: ^text; do Loop: (# do getLine -> something[]; 0->something[]; (* <-------------- new line inserted *) (if 'Test:'->something.regexp_match then 'Yes, I found Test: at the Beginning of the line' -> putLine; else '.' -> put; if); restart Loop #) #) -- Jorgen Lindskov Knudsen, Computer Science Department, Aarhus University Ny Munkegade 116, DK-8000 Aarhus C, DENMARK E-mail: jlknudsen@daimi.aau.dk, Phone: +45 89 42 32 33, Fax: +45 89 42 32 55