Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Finding text within text

Featured Replies

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

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

  • Author

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

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.