Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Chrtran() applied selectively
Message
De
07/06/2016 02:49:35
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01636985
Message ID:
01637040
Vues:
62
Karen,

It's just a matter of adding a space in the second parentheses group - see below ( I changed it also to not include 0x7f)

Antonio's approach and mine differ
Antonio takes any char as a separator while I want to specify what the separators are

For the moment they are ( space is the first char)
 !"#$%&'()*+,-./{|}~
function do_it()
	
	local regexObj
	regexObj = createobject('VBScript.RegExp')
	regexObj.Global = .t.
	regexObj.IgnoreCase = .f.
	regexObj.Pattern = '(\[\d{1,4})([ \x21-\x2f\x7b-\x7e])(\d{1,4}\])'
	
	local s, x
	s ='1st-title: ANAME-HER : 3520931 place[4443 4444]' &&&XXX

	?s
	x = m.regexObj.Replace(m.s, '$1.$3')
	?x	
endfunc

&& separators to clipboard -
	local separators, i
	separators = ''
	for i = 0x21 to 0x2f
		separators = m.separators + chr(m.i)
	endfor
	for i = 0x7b to 0x7e
		separators = separators + chr(m.i)
	endfor
	_cliptext = m.separators
This is also a possibility - separator is any chat outside _ a to z, A to Z and 0 to 9
regexObj.Pattern = '(\[\d{1,4})(\W)(\d{1,4}\])'
>actually your solution greg does well but does not replace a space with a dot whereas Antonio's solution does.
>
>s ='1st-title: ANAME-HER : 3520931 place[4443 4444]' &&&XXX
>
>using Antonio's middle parameter replaces space with dot - so perhaps combining the two.
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform