Jump to content

Recommended Posts

Hello.

I am experiencing difficulty trying to extract specific information out of a larger block of text.

The block of text I have is several kilobytes long and a response from and IMAP server - the complete email - header and all. throughout this text are the words "date" and one instance of "Date". When I use MiddleWords or MiddleValue for "Date" I get all occurrences of the word - regardless of the case. I then started looking for the condition where the first character of that word was Char(68) - which is capital D - yet is still finds all occurrences of the word. (I tried using the "==" in my search, but that can only be used in a Find command.)

Left( MiddleValues( $_imap_text; $_word_num; 1) ; 1 ) = Char(68)
(where $_word_num is an incrementing variable in a loop for the length of the text)

I would have thought that MiddleWords or MiddleValues would have returned the text verbatim, but it seems to be case-ignorant.
Perhaps this is the wrong way to search through this text?

Is somebody able to give me a better way to do this search please? Or tell me what I am doing wrong above?

Having said this, I know that 360Works and Dacon etc make tools to do the entire email-reading thing, however, I have the raw email data already, I'm just trying to work the Filemaker text functions to get what I need.

Greg


 

Edited by Greg Hains
Additional information
Link to post
Share on other sites

Only a handful of text functions are case-sensitive:

  • Exact()
  • Filter()
  • Substitute()

and, of course, Char() and Code().

56 minutes ago, Greg Hains said:

I would have thought that MiddleWords or MiddleValues would have returned the text verbatim,

They do. The problem is with your test: it uses the = operator, which is case-insensitive. To make a case-sensitive comparison, you must use the Exact() function:

"d" = "D"

returns True, but:

Exact ( "d" ; "D" )

returns False.


There is probably a better way to extract the information you need, besides looping over all instances of the word "date" (or even worse, over all the words). For example, you could use something like:

Position ( Substitute ( text ; "Date" ; Char (2) ) ; Char (2) ; 1 ; 1 )

to return the position of the first occurrence of the pattern "Date" in text using a case-sensitive search.

 

Edited by comment
Link to post
Share on other sites

Hi Comment,

Great suggestion thank you - using Exact() - I will implement this.
I will also use the Position() function as well.

Many thanks as always. :)
Greg

Link to post
Share on other sites

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.