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

Text Parsing Help - suffix?


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

Recommended Posts

I'm currently using the following code below to text parse a field in my database.

It has worked GREAT however I've come to the end of the text and I'm not sure how to say: Pull all text after the Prefix and don't stop at the suffix because there is no suffix.

Any Ideas?

 

Let ( [
Textfield = BWIA2 FMP11 2::Web Quote Entry ;
prefix = "Comments / other pilots / Explain Losses:" ;
suffix = "Bill White Insurance" ;
start = Position ( Textfield ; prefix ; 1 ; 1 ) + Length ( prefix ) ;
end = Position ( Textfield ; suffix ; start ; 1 )
] ;
Middle ( Textfield ; start ; end - start )
)

Link to comment
Share on other sites

Play around with this calculation:

Let ( [
Textfield1 = "Comments / other pilots / Explain Losses: this is the text I am after so be cool Bill White Insurance" ;
Textfield2 = "Comments / other pilots / Explain Losses: this is the text I am after so be cool" ;
Textfield3 = "this is the text I am after so be cool Bill White Insurance" ;
prefix = "Comments / other pilots / Explain Losses:" ;
suffix = "Bill White Insurance" 

] ;

Trim(Substitute(
Textfield1
;[prefix, ""]
;[suffix, ""])) & "¶¶" & 

Trim(Substitute(
Textfield2
;[prefix, ""]
;[suffix, ""])) & "¶¶" &

Trim(Substitute(
Textfield3
;[prefix, ""]
;[suffix, ""])) 

)

Obviously, replace your field with my test string. 

Hope this helps!

Link to comment
Share on other sites

I'm not sure how to say: Pull all text after the Prefix and don't stop at the suffix because there is no suffix.

Your question can be read in two ways:

(a) extract all text after the prefix; OR

(b) if there is a suffix, extract the text between the prefix and the suffix; otherwise extract all text after the prefix.

 

  • Like 1
Link to comment
Share on other sites

the answer would be A. Extract all text after the prefix.

That's good, because that's the easy one:

Let ( [
prefix = "your prefix here" ;
start = Position ( Textfield ; prefix ; 1 ; 1 ) + Length ( prefix )
] ;
Right ( Textfield ; Length ( Textfield ) - start + 1 )
)

 

Link to comment
Share on other sites

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