Slight mod in case of multiple <AccountNum> tags ...

loRegExp.pattern = "<AccountNum>([0-9]*?)</AccountNum>"

or: (This should be faster as well)

loRegExp.pattern = "<AccountNum>([^<]*)</AccountNum>" 



-----Original Message-----
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Darren
Sent: Saturday, 23 May 2015 5:28 AM
To: profoxt...@leafe.com
Subject: RE: Regular expressions (Replace Variable value between 2 fixed
values)

This is one way ...

lcStr = "fjklfjkdl lkhjegfblkhehbghgh ngbh. rngt" + CHR(13) + CHR(10) +
"<AccountNum>999999999</AccountNum>" + CHR(13) + CHR(10) +
"jfewrjkbrgejklhbjkgjklebgrdlbgrekrjh"

loRegexp = CREATEOBJECT("vbScript.regexp")

WITH m.loRegexp
  .ignorecase = .T.
  .global     = .T.
  .multiline  = .F.
ENDWITH   

loRegExp.pattern = "<AccountNum>([0-9]*)</AccountNum>"

lcnewStr = loRegExp.replace(m.lcStr, "REPLACEMENTTEXT")

? lcNewStr

-----Original Message-----
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Ken
Kixmoeller (ProFox)
Sent: Friday, 22 May 2015 1:34 AM
To: profoxt...@leafe.com
Subject: Regular expressions (Replace Variable value between 2 fixed values)

RegEx makes me irregular!!!

I guess I need to take a class or something. Angers me when I can't figure
out something like this....

Nevertheless, I have a timely need to make this string:

"<AccountNum>999999999</AccountNum>"

to this:

"<AccountNum></AccountNum>"

NOTES:
 -- The string shown is part of a much larger string.
 -- The 9s are variable-length numeric characters.

Thank you so much - ---

Ken


--- StripMime Report -- processed MIME parts --- multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/00fe01d094c6$96da0390$c48e0ab0$@ozemail.com.au
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to