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

Extract text without unique suffix string?


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

Recommended Posts

Posted

Hi

I'm trying to extract text from field using this calculation.

Let ( [

start = Position ( text ; prefix ; 1 ; 1 ) + Length ( prefix ) ;

end = Position ( text ; suffix ; start ; 1 )

] ;

Middle ( text ; start ; end - start )

)

The problem is that I don't have a unique suffix string. The prefix string is unique and I'd like Filemaker to extract the text between the prefix and the first occurrence of the suffix that comes after the prefix.

Did that make any sense?

/Johan

Posted

Only one.

The suffix is always the same, but may occur several times through out the text.

Its's the text between the unique prefix and the first time the suffix occurs (after the prefix) that I want to extract.

Here is a simple example:

Steve likes Apple, Bill hates Apple.

Steve and Bill being the prefixes and Apple is the suffix.

/Johan

Posted

If I don't use a unique suffix the calculation field remains blank.

However if I change it to a unique suffix it extracts the text. Why is that?

Posted

I don't understand your question: the calculation returns " likes " when prefix = "Steve" and suffix = "Apple". If you change the prefix to "Bill" and leave suffix = Apple", the result will be " hates ".

Posted

I'm sorry, my mistake. I accidentally put a -1 instead of 1

Let ( [

start = Position ( text ; prefix ; 1 ; 1 ) + Length ( prefix ) ;

end = Position ( text ; suffix ; start ; -1 )

] ;

Middle ( text ; start ; end - start )

)

It works fine now! :blush2:

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