Skip to content

Commit e45f67c

Browse files
committed
improve: recognize "грн" word (without price) as UAH.
Fix #1297
1 parent 6c2008b commit e45f67c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class SeriesInfoExtractorServiceImpl implements SeriesInfoExtractorServic
7979
private static final Pattern RUB_CURRENCY_REGEXP = Pattern.compile("[0-9][ ]?р(уб|\\.)");
8080

8181
// Regular expression that matches Ukrainian hryvnia.
82-
private static final Pattern UAH_CURRENCY_REGEXP = Pattern.compile("[0-9] грн");
82+
private static final Pattern UAH_CURRENCY_REGEXP = Pattern.compile("([0-9] |\\b)грн\\b");
8383

8484
// Regular expression that matches US dollar.
8585
private static final Pattern USD_CURRENCY_REGEXP = Pattern.compile("[0-9]\\$");

src/test/groovy/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImplTest.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,8 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
670670
fragment | _
671671
'CAD' | _
672672
'труб' | _
673+
'агрн' | _
674+
'грном' | _
673675
}
674676

675677
def 'extractCurrency() should extract exactly specified currency'() {
@@ -710,6 +712,7 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
710712
service.extractCurrency(fragment) == 'UAH'
711713
where:
712714
fragment | _
715+
'грн' | _
713716
'135.74 грн' | _
714717
}
715718

0 commit comments

Comments
 (0)