From: Steve Throckmorton Date: 2006-07-18T02:50:04+09:00 Subject: Re: mystery regexp There ya go. Thanks. gregarican wrote: > Check out http://www.zenspider.com/Languages/Ruby/QuickRef.html#11 for > details on this portion of the regex. It seems to involve look-ahead > capability. > > HTH. > > Steve Throckmorton wrote: > >>I found this regexp in the docs for the OptionParser class, and I don't >>understand it. Google hasn't helped, nor has the Pickaxe, so I thought >>I would ask here. The purpose of the code is to ensure that a file >>extension submitted by the user begins with a period (a dot). >> >>file_ext.sub!(/\A\.(?=.)/, ".") >> >>I understand all except (?=.) As far as I can tell the regexp works >>fine without it. I can delete the dot inside the parens, and the code >>still runs. I can change the = to a - and the code runs, but if I >>substitute a letter or a * instead, it doesn't. >> >>Someone please clue me in here. What is this thing? > >