@@ -7182,24 +7182,40 @@ R.sliceTo = search => s => {
71827182/* Create a more general bound than `\b` by combining additional character
71837183classes like `[x-z]` or "\w" or even "ß" in a disjunctive manner. */
71847184
7185+
71857186R . preBound = flags => ( ...classes ) => {
71867187 const bound = "(?<=^|" + classes . join ( "|" ) + ")" ;
71877188 return R ( bound , flags ) ;
71887189} ;
71897190
71907191
7192+ // default prefix bound
7193+
7194+ R . preBound_ = R . preBound ( "v" ) ( "[^\\p{L}]" ) ;
7195+
7196+
71917197R . sufBound = flags => ( ...classes ) => {
71927198 const bound = "(?=$|" + classes . join ( "|" ) + ")" ;
71937199 return R ( bound , flags ) ;
71947200} ;
71957201
71967202
7203+ // default suffix bound
7204+
7205+ R . sufBound_ = R . sufBound ( "v" ) ( "[^\\p{L}]" ) ;
7206+
7207+
71977208R . inBound = flags => ( ...classes ) => {
71987209 const bound = "(?:" + classes . join ( "|" ) + ")" ;
71997210 return R ( bound , flags ) ;
72007211} ;
72017212
72027213
7214+ // default infix bound
7215+
7216+ R . inBound_ = R . preBound ( "v" ) ( "[^\\p{L}]" ) ;
7217+
7218+
72037219//█████ Generalizing ██████████████████████████████████████████████████████████
72047220
72057221
@@ -9349,8 +9365,12 @@ S.splitName = titles => s => {
93499365 const titles2 = [ ] ;
93509366
93519367 for ( const title of titles ) {
9352- if ( R . iv ( `\\b${ R . escape ( title ) } ( |\\b)` ) . test ( s ) ) {
9353- s = s . replaceAll ( R ( `\\b${ R . escape ( title ) } ( |\\b)` , "giv" ) , "" ) ;
9368+ const rx = R . giv (
9369+ `${ R . preBound_ . source } ${ R . escape ( title ) } ( |${ R . sufBound_ . source } )`
9370+ ) ;
9371+
9372+ if ( rx . test ( s ) ) {
9373+ s = s . replaceAll ( rx , "" ) ;
93549374 titles2 . push ( title ) ;
93559375 }
93569376 }
@@ -9363,7 +9383,7 @@ S.splitName = titles => s => {
93639383 lastNames = lastName . split ( / [ \- ] / ) ;
93649384
93659385 return {
9366- title : titles2 . join ( " " ) ,
9386+ titles : titles2 ,
93679387 firstName : firstName2 ,
93689388 middleNames,
93699389 lastNames
@@ -9383,7 +9403,7 @@ S.splitName = titles => s => {
93839403 lastNames = compos [ compos . length - 1 ] . split ( / - / ) ;
93849404
93859405 return {
9386- title : titles2 . join ( " " ) ,
9406+ titles : titles2 ,
93879407 firstName,
93889408 middleNames,
93899409 lastNames
0 commit comments