Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hey gang,

This is probably easy, but I'm stuck. I have a text field that is approx. several hundred lines long. Within that is burried a code that I need to dig out. I can locate the code, sort of. I know that the code lies between a " character at the left side, and a : on the right side.

So how do I select the text that is between the " and the : and paste it to another field?

Thanks,

Frustrated Dan

Posted

if it's a one-time thing: click in the field, select all, copy paste into your favorite text editor, then do a search.

Everything else will probably not work because within 700 lines of text, you will have a lot of " and : s..

If they are the only ones, a 3-line script would be enough:

setfield tempglobal, mytextfield

setfield tempglobal, Right(tempglobal;position(tempglobal,""",1,1))

setfield tempglobal, Left(tempglobal;position(tempglobal,":",1,1))

try a patterncount(textfield;""") and ":") first ...

Posted

No, it isn't a 1-time thing. But I do have more information:

Within my large field there is a line

<OPTION VALUE="10000US271450003011022:Y:50:100$10000US271450003011022">... ... ... ... Block: Block 1022

I need to get the string of letters and numbers that is after the opening " and the first : . What I'm sure of is that the phrase "Block: Block" will only appear on this line and no other line in the field. This is very good. I go to the field, search forward to find "Block: Block", then search backward to find <, then forward again to find " .

At this point I need to copy the string of letters and numbers between " and : . I'm not certain that the string of characters will always be the same length.

If I could grab that single line of text and paste it somewhere I think it would be straightforward to tease out the code using pattern matching and other text functions.

Thoughts?

Dan

Posted

okay,not that we have the unique values....

make an aux calc field

Middle(textfield,position(textfield;"Block: Block 1022";1;1)-1000;1000)

should give you some text where "<OPTION VALUE=""" should be unique, you may verify this with the patterncount(). Decrease to 500 if not....

now continue with

Middle(auxfield;Position("<OPTION VALUE=""";1;1)+Lenght("<OPTION VALUE=""");Length("10000US271450003011022:Y:50:100$10000US271450003011022")) -

if the lenght is variable, you will have to search for the first occurence of ">"

Posted

but if you write your little web-fetcher in perl, it will be a simple regex expression......

And it may be simpler to count all the <option value= in the specific form, so you can access it by occurence, provided this is a static web form.

Posted

This will do it. Example attached - similar to Christian's approach. The issue is what number do you make the "100" to avoid going too far back and risk getting another "

Middle(

Middle(Text_IP,Position(Text_IP, "Block:Block", 1, 1)-100,100),

Position(Middle(Text_IP,Position(Text_IP, "Block:Block", 1, 1)-100,100),"""",1,1) + 1,

Position(Middle(Text_IP,Position(Text_IP, "Block:Block", 1, 1)-100,100),":",1,1) - Position(Middle(Text_IP,Position(Text_IP, "Block:Block", 1, 1)-100,100),"""",1,1) - 1

)

Also, beware of getting text with smart quotes in it. If this is the case, then you will need to do some substitutes to replace both opening and closing smart quotes with vertical ones before you apply the above calc.

Test Code Extractor.fp5.zip

Posted

Thanks guys,

I think the most disturbing part of this whole process is the realization that my picture looks way too much like the monster icon that cjaeger is using! Perhaps we were separated at birth.

I think I've got the problem solved. Because of the way the data is structured, I've gotten it in a slightly different way than what you've suggested. Fortunately it is more straightforward. I realized that there is another unique phrase that come just before the code I need -- "Block Group: Block Group". So it is a simple case of getting the Position of that phrase, and the Position of "Block: Block", and subtracting the Position of the first from the Position of the second to get the Length. Then I just find it using Middle. I pull this out into another field and get what is between " and : .

I've learned that the big drawback to FM text searching is that there is no way to find wildcards within text, as far as I can tell. I thought of going the Perl route. I haven't used Perl in a while. As I recall, there isn't a way to compile a script into an exec file -- it has to run it its native format, meaning that Perl has to be installed and the computer set up as a web server. This would be ok if I was the only one using this solution, but I'll be distributing it to some less-than sophisticated users, and it would never work in practice. If there is a way to compile Perl scripts, I'd be very appreciative of the insight.

Thanks for all of your ideas,

Dan

Posted

Dan,

Could be w.r.t. the photo...

Lots of similarity in the aspect, but since you cropped the horns off the top of your photo - its a bit hard to be certain.

This topic is 7878 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.