in reply to Default value for capture in regular expression

I wouldn't do that with a (single) regex at all. There are tons of other ways: in particular in this case your data seems fairly regular. Thus one possibility (and just one amongst the may WTDI) may be:

  1. read in by paragraphs;
  2. split on \n;
  3. parse the single lines to get, say, ($data, $value);
  4. use a hash:
    my %defult = (what => 'wtf?', date => 'no date', data => 'no data'); # ... unless (exists $default{$data}) { warn "unexpected field: $data'"; # ... } $value ||= $default{$data};
  5. Of course //= would be better suited for this, but since we currently don't have it yet unless we installed a patch, ||= should be enough. If it is not or in case of doubt, use your own defined test instead.