mayhewsw / bibtex-js

Automatically exported from code.google.com/p/bibtex-js
0 stars 0 forks source link

regex does not take into account question mark #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The regular expression used to filter out.  The preamble can contain ???? like 
shown below:

@misc{publisher_hrsc_????,
    title = {{HRSC} Data Browser},
    author = {publisher}
}

This was my solution:

  this.key = function() {
    var start = this.pos;
    while(true) {
      if (this.pos == this.input.length) {
        throw "Runaway key";
      }

      if (this.input[this.pos].match("[a-zA-Z0-9_:?\\./-]")) {
        this.pos++
      } else {
        return this.input.substring(start, this.pos).toUpperCase();
      }
    }
  }

Original issue reported on code.google.com by JCCC...@gmail.com on 2 Jul 2011 at 7:53