>Lets divide the pattern in 6 groups:
>Group 1: [0-9]+;
>Any quantity of numbers followed by ; and a space
>Group 2: [0-9]+
>Any quantity of numbers followed by a space
>Group 3: [0-9]+
>Any quantity of numbers followed by a space
>Group 4: SCHEMA -
>Exactly the text SCHEMA -
>Group 5: here's the problem...
>Anything unless exactly the text information-schema or anything that doesn't start with pg_
>Group 6: [a-zA-Z]+
>Any quantity of characters.
>Lets divide the pattern in 6 groups:
>Group 1: [0-9]+;
>Any quantity of numbers followed by ; and a space
>Group 2: [0-9]+
>Any quantity of numbers followed by a space
>Group 3: [0-9]+
>Any quantity of numbers followed by a space
>Group 4: SCHEMA -
>Exactly the text SCHEMA -
>Group 5: here's the problem...
>Anything unless exactly the text information-schema or anything that doesn't start with pg_
>Group 6: [a-zA-Z]+
>Any quantity of characters.
For readability, I have
- used [ ] to represent the space char
- put the different groups within parentheses
- used p5 for group 5
local regexObj
regexObj = createobject('VBScript.RegExp')
regexObj.Global = .f.
regexObj.IgnoreCase = .f.
regexObj.MultiLine = .f.
local pattern, p5
pattern = '^(\d+;[ ])(\d+[ ])(\d+[ ])(SCHEMA[ ]-[ ])(%%p5%%)([a-zA-Z]+)$'
p5 = '(?!information-schema[ ])(?!pg_)[\w-]+[ ]'
pattern = strtran(m.pattern, '%%p5%%', m.p5)
regexObj.Pattern = m.pattern
local samples
text to samples noshow pretext 7
8; 2615 1490850 SCHEMA - e9999 postgres
8; 2615 1490850 SCHEMA - pg_catalog postgres
8; 2615 1490850 SCHEMA - pg_temp postgres
8; 2615 1490850 SCHEMA - information-schema postgres
8; 2615 1490850 SCHEMA - information-test postgres
8; 2615 1490850 SCHEMA - information postgres
8; 2615 1490850 SCHEMA - schema postgres
8; 2615 1490850 SCHEMA - myinformation-schema postgres
8; 2615 1490850 SCHEMA - information-schemas postgres
endtext
local aa[1], naa, i, s
naa = alines(aa, m.samples)
for i = 1 to m.naa
s = m.aa[m.i]
?m.i, m.regexObj.Test(m.s), m.s
endfor
Gregory