sqllite3 - Absolute .db path & Working with Delimiters

Thanks Shane and Nigel.
I missed the fact that * was meaning 0 or some occurrences while + means 1 or some occurrences.

Yvan KOENIG running Sierra 10.12.1 in French (VALLAURIS, France) samedi 10 décembre 2016 15:48:09

Since you tried plus twice I think you need to use curly braces.

An atom followed by *' matches a sequence of 0 or more matches of the atom. An atom followed by +’ matches a sequence of 1 or more matches of the atom.
An atom followed by `?’ matches a sequence of 0 or 1 matches of the atom.
An atom followed by {n} matches a sequence exactly n times of the atom
An atom followed by {n,} matched a sequence n times or more of the atom
An atom followed by {n,m} matched a sequence n times or more and equal or less than m of the atom

Instead of ++ I think you want {2,} instead.

Thanks but it’s not my script which used ++, it’s Nigel’s one :wink:

Yvan KOENIG running Sierra 10.12.1 in French (VALLAURIS, France) lundi 12 décembre 2016 15:19:50

Hi DJ.

My understanding is that the brace equivalent of “++” is “{1,}+” and of “*+” it’s “{0,}+”.

use framework "Foundation"

set theString to "customer1 London.,-----customer1@email.com,customer1@ftp.com#!?[]^(){}Pass-word" -- Deliberate mish-mash of irrelevant characters between fields.

set theAnswer to current application's NSMutableString's stringWithString:theString
theAnswer's replaceOccurrencesOfString:"[^[:alnum:].@-][^[:alnum:].@]{0,}+|-[^[:alnum:].@]{1,}+" withString:linefeed options:(current application's NSRegularExpressionSearch) range:{0, (count theString)}
set {printerName, printerSite, contactEmail, ftpEmail, ftpPassword} to paragraphs of (theAnswer as text)

My mistake I completely overlooked the possessive quantifier.