in reply to a small regexp question

$1 contains the part of the input string that actually matched the part of the regular expression enclosed in the first set of round brackets. Because "a sample string" is not a substring of "a_sample_string", then the following is true:

There does not exist a regular expression for which under the given circumstances $1 can possibly be "a sample string", sorry.

One world, one people

Replies are listed 'Best First'.
Re^2: a small regexp question
by blazar (Canon) on Jul 29, 2005 at 09:50 UTC
    Well, seeing the sort of things some people can do, I guess that there may be some regexen wizardry to achieve what the OP is after. I'm not really sure, though. And even if possible, I wonder why one should make his like hard like that, except, possibly, for a challange.
      Sure - you could for example write your own regexp engine to have different behaviour and patch it in, but I see the set of possible such wizardry as not intersecting with the set of acceptable solutions.

      One world, one people