Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Escaping regular text string for use in Reg Ex???
Message
 
To
25/03/2011 09:41:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01504973
Message ID:
01504975
Views:
54
>Anyone?

I don't know what kind of escaping regex needs, but here's some super simple xml escaping code
LPARAMETERS lcString
	
	lcString=STRTRAN(lcString,"&","&")
	
	lcString=STRTRAN(lcString,"<","&lt;")
	lcString=STRTRAN(lcString,">","&gt;")
	lcString=STRTRAN(lcString,'"',"&quot;")
	lcString=STRTRAN(lcString,"'","&apos;")
	
	LOCAL lnX
	FOR lnX=128 TO 255
		lcString=STRTRAN(lcString,CHR(lnX),"&#"+ALLTRIM(STR(lnX))+";")
	ENDFOR
	RETURN lcString
Brandon Harker
Sebae Data Solutions
Previous
Reply
Map
View

Click here to load this message in the networking platform