Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One thing i've always missed from the Perl programming language is the regex operators.

You could do:

  my $var='foo foo bar and more bar foo!!!';

  if($var=~/(foo|bar)/g){  # does the variable contain foo or bar?

    print "foo! $1 removing foo..\n";

    # remove our value..

    $var=~s/$1//g;

  }



Awesome job, i did a hack bootstrapping the tokenizer to do the same thing in php, didn't release it though.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: