dbTalk Databases Forums  

Calculation advice needed: Substitute and GREP-like abilities in FMP

comp.databases.filemaker comp.databases.filemaker


Discuss Calculation advice needed: Substitute and GREP-like abilities in FMP in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sfcrowsnest@gmail.com
 
Posts: n/a

Default Calculation advice needed: Substitute and GREP-like abilities in FMP - 09-15-2005 , 09:43 AM






Hi all

I'm currently using FMP version 6.0 on a PC (got 8.0 ordered and in the
post, though), and have a calculation/scripting question I would
appreciate a head's-up on.

I'm currently using a substitute calculation to automatically parse
articles full of text and re-write them. E.g. to find instances of '£'
and replace instead with 'GBP' (or to replace '$' with 'USD').

I'm using something like this to do the job ...

Substitute (body, " GBP " , " £ ")

or

Substitute (body, " a really great " , " a decent ")

For my purposes, the articles I am parsing consist of two different
types of text. Commentary by the article writer - for which I am happy
to change the text using my substitute calculation as shown above - and
quotes by any people interviewed, where they speak, yack, comment and
talk ... and in this latter instance, I would prefer to leave their
quotes untouched by the Substitute calculation. Mainly because people
get very angry if you change anything they said.

People's comments always start/end with speech marks, either a single
', or a double " - depending on whether UK or US spelling rules are
being followed (e.g. the text might read something like ... Today Bob
Smith commented on the bombing: "I am ready shocked by the violence of
the insurgents.")

Ideally I would like to parse the article and make my substitution
rules heat-seeking, so to speak, so they apply to all of the text
EXCEPT where paragraphs of text are surrounded by speech marks - either
single ' or double ", which they should ignore.

Any ideas how to achieve this using FMP?

I am fairly sure I could do this with regular expressions and GREP
using another application, but in FMP, unless I am missing a trick,
GREP seems to be limited to the likes of ...
Substitute(Substitute(body, " GBP " , " £ "), "(R)" , "Registered
Trade Mark") ... which seems to me a bit of an omission by Filemaker.

Your ideas gratefully received.

Stephen


Reply With Quote
  #2  
Old   
Jens Rasmussen
 
Posts: n/a

Default Re: Calculation advice needed: Substitute and GREP-like abilities in FMP - 09-15-2005 , 10:37 AM






<sfcrowsnest (AT) gmail (DOT) com> wrote:

Quote:
Any ideas how to achieve this using FMP?
My hint would be the PatternCount function.
If your text is really well-structured, occurrences of start quotes
would have uneven numbers and occurrences of end quotes would have even
numbers.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.