Jump to content

Extract text without unique suffix string?


eljotor

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

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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