Jump to content

Parsing "<"anything in between replaced"/>"


This topic is 6667 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi To All,

I am trying to parse some files into another format.

It would really help if I could use a replace function that would search for a start occurence and an end occurence that could be defined and then replace anything in between with defined text.

I found the following function

SubstituteRange ( text; beginString; endString; replaceString ) at the following url http://www.briandunning.com/cf/122 (ps thanks to brian for all his cool functions)

But cannot get it to work! Any help would be much appreciated

Thanks,

Lance

Link to comment
Share on other sites

I also tested this one a few weeks ago, and it worked for me too.

Maybe you can attach a sample of the text that isn't working for you, and maybe we can see what is not working better..

Lee

Link to comment
Share on other sites

Hi Ender,

How did I know I was going to get that as a response! : )

I have cut and paste the function 3-4 times changed various bits. The best I can get is it removes the search start text and the search end text along with anything in between. No replace is happening.

Any thoughts would be much appreciated, I can't for the life of me see anything I am putting in wrong. : (

Thanks,

Lance

Link to comment
Share on other sites

Ah, there is an error in that CF. I had just tried it with an empty replacement string so I didn't see it (it helps to know what you're having trouble with.)

This is the fix:

...

Case(

lenBegin > 0 and lenEnd > 0 and ptBegin > 0 and ptEnd > lenEnd;

modText & replaceString & SubstituteRange(remainText; beginString; endString; replaceString);

text))

Link to comment
Share on other sites

This topic is 6667 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.