lookahead ?
[email protected] (Aaron J Mackey)
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <Pine.OSF.4.33.0104242223430.19590-100000@alpha10.bioch.virginia.edu> |
Ok, now the line I'm trying to deal with is "some amount of whitespace,
then some text, then starting at column 48 a number, followed by a period,
followed by another number". I want to capture the text (the "title"),
and the two numbers (major and minor versions):
line: title // <reject: $thiscolumn != 48> major \. minor
title: ??WHAT GOES HERE??
major: digits
minor: digits
digits: /\d+/
In a regex(p)?, I think I'd know what to do: positive lookahead on the
whitespace:
my ($title, $major, $minor) =
$line =~ m/^\s* # leading whitespace
(.*?) # the title
(?:\s+(?=\d+\.\d+\s*$)) # the space preceeding the numbers
(\d+) # the major version number
\.
(\d+) # the minor version number
/x;
Can I accomplish this in a RD grammer without changing <skip:> ?
Thanks (yet again),
-Aaron