Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/core/regex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const numeric = '[0-9]+'
const alphanumeric = '[A-Z $%*+\\-./:]+'
const lettersAndCharacters = '[A-Z $%*+\\-./:]+'
let kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +
'[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +
'[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +
Expand All @@ -12,7 +12,7 @@ exports.KANJI = new RegExp(kanji, 'g')
exports.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g')
exports.BYTE = new RegExp(byte, 'g')
exports.NUMERIC = new RegExp(numeric, 'g')
exports.ALPHANUMERIC = new RegExp(alphanumeric, 'g')
exports.LETTERS_AND_CHARACTERS = new RegExp(lettersAndCharacters, 'g')

const TEST_KANJI = new RegExp('^' + kanji + '$')
const TEST_NUMERIC = new RegExp('^' + numeric + '$')
Expand Down
4 changes: 2 additions & 2 deletions lib/core/segments.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function getSegments (regex, mode, str) {
*/
function getSegmentsFromString (dataStr) {
const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr)
const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr)
const letterAndCharacterSegs = getSegments(Regex.LETTERS_AND_CHARACTERS, Mode.ALPHANUMERIC, dataStr)
let byteSegs
let kanjiSegs

Expand All @@ -62,7 +62,7 @@ function getSegmentsFromString (dataStr) {
kanjiSegs = []
}

const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs)
const segs = numSegs.concat(letterAndCharacterSegs, byteSegs, kanjiSegs)

return segs
.sort(function (s1, s2) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/core/regex.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ test('Regex', function (t) {
t.ok(Regex.NUMERIC instanceof RegExp,
'Should export a regex for NUMERIC')

t.ok(Regex.ALPHANUMERIC instanceof RegExp,
'Should export a regex for ALPHANUMERIC')
t.ok(Regex.LETTERS_AND_CHARACTERS instanceof RegExp,
'Should export a regex for LETTERS_AND_CHARACTERS')

t.ok(Regex.BYTE instanceof RegExp,
'Should export a regex for BYTE')
Expand Down