File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const SearchParser = {
7
7
// Convert any Lexis Nexis formatted case numbers to standard format
8
8
// Example: 5902022CR 714844 => 22CR714844-590
9
9
const normalized = input . replace (
10
- / (?< county_code > \d { 3 } ) (?: 1 9 | 2 0 ) (?< year > \d { 2 } ) (?< case_type > [ A - Z a - z ] { 2 } ) ? [ S ] ? (?< case_no > \d { 6 } ) / g,
10
+ / (?< county_code > \d { 3 } ) (?: 1 9 | 2 0 ) (?< year > \d { 2 } ) (?< case_type > [ A - Z a - z ] { 2 } ) ? (?: S | \s \n ? ) ? (?< case_no > \d { 6 } ) / g,
11
11
( _match , ...args ) => {
12
12
const groups = args [ args . length - 1 ] ;
13
13
const caseType = groups . case_type || 'CR' ;
Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ describe('SearchParser', () => {
29
29
// Example: 5902022CR 714844 => 22CR714844-590
30
30
expect ( SearchParser . parseSearchInput ( '5902022CR 714844' ) ) . toEqual ( [ '22CR714844-590' ] ) ;
31
31
expect ( SearchParser . parseSearchInput ( '5902022CR714844' ) ) . toEqual ( [ '22CR714844-590' ] ) ;
32
+ expect ( SearchParser . parseSearchInput ( '5902022CR\r\n714844' ) ) . toEqual ( [ '22CR714844-590' ] ) ;
33
+ expect ( SearchParser . parseSearchInput ( '5902022CR\n714844' ) ) . toEqual ( [ '22CR714844-590' ] ) ;
34
+ expect ( SearchParser . parseSearchInput ( '5902022CR\t714844' ) ) . toEqual ( [ '22CR714844-590' ] ) ;
32
35
expect ( SearchParser . parseSearchInput ( '1232023CV 123456' ) ) . toEqual ( [ '23CV123456-123' ] ) ;
33
36
expect ( SearchParser . parseSearchInput ( '1232023CRS987654' ) ) . toEqual ( [ '23CR987654-123' ] ) ;
34
37
expect ( SearchParser . parseSearchInput ( '3302021S000986' ) ) . toEqual ( [ '21CR000986-330' ] ) ;
@@ -37,9 +40,12 @@ describe('SearchParser', () => {
37
40
it ( 'should handle multiple Lexis Nexis case numbers' , ( ) => {
38
41
expect (
39
42
SearchParser . parseSearchInput (
40
- '5902022CR 714844 5902022CR714844 3302021S000986 1232023CV 123456 1232023CRS987654'
43
+ '5902022CR 714844 5902022CR714844 5902022CR\r\n714844 5902022CR\n714844 5902022CR\t714844 3302021S000986 1232023CV 123456 1232023CRS987654'
41
44
)
42
45
) . toEqual ( [
46
+ '22CR714844-590' ,
47
+ '22CR714844-590' ,
48
+ '22CR714844-590' ,
43
49
'22CR714844-590' ,
44
50
'22CR714844-590' ,
45
51
'21CR000986-330' ,
You can’t perform that action at this time.
0 commit comments