@@ -16,8 +16,8 @@ export function analyseText(settings: Settings): {
1616 selection = cleanText ( range . toString ( ) )
1717 // test if the selection contains a description for the header starting with some common words used for and ending with a colon or a vertical bar
1818 let customHeaderSearchTerms = settings . textSelection . header . join ( '|' )
19- customHeaderSearchTerms = customHeaderSearchTerms != '' ? '|' + customHeaderSearchTerms : ''
20- const headerRegexpString = `(?:^\\s* (?:header|subje[ck]t|betreff|files?${ customHeaderSearchTerms } ) ?.*? (?::| \\s)+)+"?(\\S.*\\S)"? $`
19+ customHeaderSearchTerms = customHeaderSearchTerms != '' ? customHeaderSearchTerms + '|' : ''
20+ const headerRegexpString = `^ (?:${ customHeaderSearchTerms } header|subje[ck]t|betreff|files?(?: name)?) (?:\\s|:)*(.*?) $`
2121 const headerRegexp = new RegExp ( headerRegexpString , 'im' )
2222 if ( headerRegexp . test ( selection ) ) {
2323 // set the header to the text after the description
@@ -44,8 +44,8 @@ export function analyseText(settings: Settings): {
4444 } else {
4545 // first check if there is actually a title prefix
4646 let customTitleSearchTerms = settings ?. textSelection . title . join ( '|' )
47- customTitleSearchTerms = customTitleSearchTerms != '' ? '|' + customTitleSearchTerms : ''
48- const titleRegexpString = `(?:^\\s? (?:titel|title ${ customTitleSearchTerms } ) ?.*? (?::| \\s)+)+(\\S.*\\S )$`
47+ customTitleSearchTerms = customTitleSearchTerms != '' ? customTitleSearchTerms + '|' : ''
48+ const titleRegexpString = `^ (?:${ customTitleSearchTerms } titel|title) (?:\\s|:)*(.*? )$`
4949 const titleRegexp = new RegExp ( titleRegexpString , 'im' )
5050 test = selection . match ( titleRegexp )
5151 if ( test ) {
@@ -56,8 +56,8 @@ export function analyseText(settings: Settings): {
5656 }
5757 // test if the selection contains a description for the password starting with some common words used for and ending with a colon or a vertical bar
5858 let customPasswordSearchTerms = settings . textSelection . password . join ( '|' )
59- customPasswordSearchTerms = customPasswordSearchTerms != '' ? '|' + customPasswordSearchTerms : ''
60- const passwordRegexpString = `(?:^\\s? (?:passwor[td]|pw|pass ${ customPasswordSearchTerms } ) ?.*? (?::| \\s)+)+(\\S.*\\S )$`
59+ customPasswordSearchTerms = customPasswordSearchTerms != '' ? customPasswordSearchTerms + '|' : ''
60+ const passwordRegexpString = `^ (?:${ customPasswordSearchTerms } passwor[td]|pw|(?:file )?pass) (?:\\s|:)*(.*? )$`
6161 const passwordRegexp = new RegExp ( passwordRegexpString , 'im' )
6262 test = selection . match ( passwordRegexp )
6363 if ( test ) {
0 commit comments