> Yes, there are. For example: you want to match any occurence of "bar" except
> if it is preceeded by "foo". I.e. you'd want to match "blabar" or "oofbar",
> but not "foobar".

I think it's important to state that the look-behind matches with zero
width, i.e. the match isn't included in the match.

If it's okay to include the prefix in the match (e.g., in a gsub, the
prefix could then be referenced as a group), this could also be
achieved without lookbehind:

require 'strscan'
#                      0         1         2         3
#                      0123456789012345678901234567890123
s = StringScanner.new('blabar oofbar foobar ofobar offbar')
#                            ^      ^             ^      ^
until s.eos?
    m = s.scan_until(/([^o]|[^o]o|[^f]oo)(bar)/)
    p s.pos
end

# =>
6
13
27
34

pos 20 is missing.

There are of course situations when this isn't possible.

Regards,
Thomas.