I need a regexp to match lines except those that end with ending in
".html" - iow - I want lines 2-5 above. I believe this may require a
negative lookbehind match. I tried the following but Ruby (1.8) gives
an undefined sequence error :
$(?<!\.html) # <---- this seems to work with other engines
Before you jump re Ruby the version I also tested this here - http://www.rubyxp.com/ and get invalid expression (fyi this tests with
Ruby 1.9). Any ideas/alternatives?
I need a regexp to match lines except those that end with ending in
".html" - iow - I want lines 2-5 above. I believe this may require a
negative lookbehind match. I tried the following but Ruby (1.8) gives
an undefined sequence error :
$(?<!\.html) # <---- this seems to work with other engines
Before you jump re Ruby the version I also tested this here - http://www.rubyxp.com/ and get invalid expression (fyi this tests with
Ruby 1.9). Any ideas/alternatives?
I need a regexp to match lines except those that end with ending in
".html" - iow - I want lines 2-5 above. I believe this may require a
negative lookbehind match. I tried the following but Ruby (1.8) gives
an undefined sequence error :
$(?<!\.html) # <---- this seems to work with other engines
Before you jump re Ruby the version I also tested this here - http://www.rubyxp.com/ and get invalid expression (fyi this tests with
Ruby 1.9). Any ideas/alternatives?
--
Toutes les grandes personnes ont d’abord été des enfants, mais peu
d’entre elles s’en souviennent.
All adults have been children first, but not many remember.
Is the Ruby regular expression syntax documented anywhere?
I was attempting to use a look-behind, but it's not supported.
The syntax is not documented in the RegExp rdocs, and I haven't seen a
site that spells out all the nitty-gritty details and pokes into the
dark corners.
You could try the Regular Expressions section of the Standard Types chapter of Programming Ruby. Be advised that this is the online version of the 1st edition that is now 8 years old. Since you seem to be using a version 1.8.x of Ruby, the Regexp parts are going to be mostly the same.
On Jul 17, 2009, at 11:30 AM, Glenn Jackman wrote:
At 2009-07-16 08:59PM, "David A. Black" wrote:
On Fri, 17 Jul 2009, BrendanC wrote:
$(?<!\.html) # <---- this seems to work with other engines
I would probably do:
lines.reject {|line| line =~ /html$/ }
Is the Ruby regular expression syntax documented anywhere?
I was attempting to use a look-behind, but it's not supported.
The syntax is not documented in the RegExp rdocs, and I haven't seen a
site that spells out all the nitty-gritty details and pokes into the
dark corners.
> $(?<!\.html) # <---- this seems to work with other engines
I would probably do:
lines.reject {|line| line =~ /html$/ }
Is the Ruby regular expression syntax documented anywhere?
I was attempting to use a look-behind, but it's not supported.
The syntax is not documented in the RegExp rdocs, and I haven't seen a
site that spells out all the nitty-gritty details and pokes into the
dark corners.
Is the Ruby regular expression syntax documented anywhere?
I was attempting to use a look-behind, but it's not supported.
The syntax is not documented in the RegExp rdocs
In my opinion, documentation is Ruby's weakest aspect by far - and the
deficiency has gotten substantially worse with ruby 1.9.
Best available information is in third-party books, which presumably
have reverse-engineered from the source code. I fairly often resort to
irb to check behaviour is what I want, and have on occasions had to
resort to reading the source.