Skip to content

Commit

Permalink
fix(stripEndings): constrain number stripping to end of lines
Browse files Browse the repository at this point in the history
fix #176
  • Loading branch information
bhajneet committed Nov 2, 2020
1 parent 05c62f5 commit 6401423
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/stripEndings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ const numberClass = getRegexClass( [
// Rahao in English, ASCII, Unicode
const pauseGroup = getRegexGroup( [ 'ਰਹਾਉ', toAscii( 'ਰਹਾਉ' ), 'Pause' ] )

// Matchers to strip out of input string
const matchers = [
// || Rahao || style endings
` ?${endingClass} ?${pauseGroup}( .*)?${endingClass}`,
// Endings followed by any number => match the rest of the line
` ?(${endingClass}|${optionalEndingClass}?)${numberClass}.*`,
// Any pause (ending + pause word) => match the rest of the line
` ?${endingClass} ?${pauseGroup}.*`,
// Any ending followed by any number => match the rest of the line
` ?(${endingClass}|${optionalEndingClass})${numberClass}.*`,
// Any numbers at the end of a line
` ?(${numberClass}+([ .]+)?(${numberClass}+)?$)`,
// Clean up any lingering ending characters
` ?${brokenEndingClass}`,
` ?${endingClass}`,
Expand Down

0 comments on commit 6401423

Please sign in to comment.