How do I extract the string of characters that fall between the tags <text> and </text>. The two tags can occur multiple times in one field, with various lengths of text before, between and after them.
Thank you in advance. I'm stumped.
How do I extract the string of characters that fall between the tags <text> and </text>. The two tags can occur multiple times in one field, with various lengths of text before, between and after them.
Thank you in advance. I'm stumped.
You just want to remove the <text> and </text> tags and leave a space in their place?
Try:
x = strValue
Trim(Replace(Replace(x,"<text>"," "),"</text>"," "))
x can be reference to a field.
The expression can be used in a query or textbox. If you want the edit to be permanently saved, use the expression in the UPDATE TO row of update query under the field need to populate with the edit.
Last edited by June7; 03-22-2012 at 02:09 PM.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
If you want to return only the text between the two tags and where there could be multiple instances of those tags in each block of text, then this could be done with a user defined function. The attached db has an example of such a function. If you have any further questions, post back.
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
Thank you for the working example, Mr. Fitzpatrick. This is indeed a wonderful learning moment for me.
Does it actually fulfil your needs?
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
Yes. It is a perfect fit!