Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Regular Expression
Message
De
25/11/2013 07:23:13
 
 
À
25/11/2013 06:29:35
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01588553
Message ID:
01588601
Vues:
142
This message has been marked as the solution to the initial question of the thread.
J'aime (1)
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform