Jump to content

Is there a "wildcard" function in filemaker if finding text?


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

Recommended Posts

I often use Nisus writer pro for a lot of word processing.

Interestingly, they have wonderful wildcard functions to find certain information.

 

so for example if you had a sentence like

 

"Maybe I can find 4859043 people there."

and that sentence was to be used in many examples like:

 

"Maybe I can find 6854 people there."

"Maybe I can find 45443 people there."

 

Then if you were to do a find/ replace

the numbers become a wildcard function called "anyword"

And if I were to write the find

It would be like this.. "Maybe I can find ANYWORD people there.

And it would select the information I am looking for.

 

I guess it would be some type of variable function....

 

Does filemaker have any type of wildcard to help with finding text?

Link to comment
Share on other sites

First of all Find means two very different things and you have to define what you are trying to do.

 

Are you trying to find records that contain this phrase in some field?

 

Or are you trying to this text within a field of the current record?

 

 

Given your previous inquiries it looks like you are trying to do the second.

Link to comment
Share on other sites

It is the second Bruce

I am sorry but the word processor made me think of how useful that could be.

I understand about what you have explained to me about the suffix and prefix pretty well now

But in the process of learning to wrap my info in between 2 tags, I found that there are many

times when there are several tags that are the same. for example

In another website

I found this in the source code

 

<div class="result-info">
<h2>Anchor of Hope Presbyterian Church</h2>
<p class="addr" data-lat="36.936827" data-lon="-80.950368">
<span>839 Danner Rd</span>

<span>PO Box 211</span>

<span>Max Meadows, VA 24360</span>
</p>
<p class="dir"><a href="http://maps.google.com/maps?q=839%20Danner%20Rd%2C%20Max%20Meadows%2C%20VA%2024360&amp;sll=36.936827,-80.950368&amp;iwloc=r0" target="_blank">See on Google Maps</a></p>
</div> <!-- /result-info -->

 

 

So as you can see there are multiple instances of text between the suffix of <span> and </span>

Given all the help you have given me I was trying to determine what to do in this case which is a little different

 

What to do if I want only the last one for example

 

If I had some kind of wild car function like I mentioned I could find that exact text. But I am not sure about it in filemaker.

Link to comment
Share on other sites

Once again you are going to have to explain what you are actually trying  to do.

 

You do not want a wildcard, I'm pretty sure.

 

In the example above I don't see any of the things you have been looking for before (website; or phone; or email; or whatever).

 

Also, please pay very careful attention to what each piece of the Position function does.

And you may want to look at the variations in the script in my example because there are really two different methods being used.

I recognize that I have not commented them or explained them. I left them for you to chew on for a while but I will add some comments to follow.

Link to comment
Share on other sites

If you are really trying to find the last instance then what you are saying is:

I have this here big chunka text.

I want to start at the end; and look backward until I get the position of the first instance of "</span>".

From there, I want to keep looking backwards through the text until I get the position of "<span>"

 

That is:

Position( bigChunk; "</span>"; length( bigChunk); -1)

Position( bigChunk; "<span>"; length( bigChunk); -1)

 

If you look at the function definition, using negative numbers for occurrence means, start at the END and look for the Nth occurrence as you move backwards through the text.

Link to comment
Share on other sites

Except that howNow has clarified that isn't what he's doing.

He's talking about text parsing.

 

I wonder if we can come up with better terminology for distinguishing these very different needs, this kind of confusion comes up fairly frequently.

Link to comment
Share on other sites

Hi hownow ... I don't know why I always want to finish that with 'brown cow', LOL.

 

If you are wishing to highlight certain tags only to make it easier to find the information you're attempting to parse then you might try a calculation of:

Substitute ( 
field you are parsing ; 
[ gHighlightString ; TextColor ( gHighlightString ; RGB ( 255 ; 0 ; 0 ) ) ] ; 
[ gHighlightString[2] ; TextColor ( gHighlightString [2]; RGB ( 0 ; 255 ; 0 ) ) ] 
)

... where gHighlightString is a repetition global where you can put in the tag you wish and the color to make it.  Well, here is an example (attached).  Opening tags are red - closing tags are green.    <--- I guess this should be reversed!! :-)

 

I created it with 12 repetitions so you can have 6 open/close tags or whatever you wish.  I confess that I was lazy on the calculation and you will need to copy and replicate it on out for the other repetitions.  


I wonder if it could be even more efficient without need of hard-coding each rep ... possibly using Extend()?  Anyway, I don't have time to consider other options now but hopefully this will get you going.

HiliteTags.fmp12.zip

Edited by LaRetta
Link to comment
Share on other sites

Me too LOL
I chose my name because I think of getting answers now so HOWNOW  but I too think of Brown Cow 

 

I have text parsing again because I am using a different type of site.

 

http://www.pcusa.org/congregations/23003/

 

Is and example site which I am trying to parse.

I have learned much from all the help I have had with my other example

but  a situation comes up in the source code of this page which presents a unique problem.

In post #4 I posted some of the source code

 

<span>Max Meadows, VA 24360</span>  is the last of the <span>  </span>  couplets but the others are the same.

I don't know how to differentiate and just capture the final one for the city state and zip. This is why I was asking about wild card functions to try to only isolate one of the couplets. I am asking anew because this is a different troubling situation for me.

 

Btw LaRetta Thanks for that wonderful example. I certainly can use that to find things quickly. Secretly I had always hoped that filemaker might be the first database that could look for colors.  Imagine color as a search criteria .. That brings up many wonderful possibilities.  Thanks

Link to comment
Share on other sites

If hownow only wants the second opening tag, easily identified by the highlight, for example, he changes the prefix to beginning with the second occurrence:

Position ( the web data ; prefix ; 1 ; 2 )

FMHelp:  Position ( text ; searchString ; start ; occurrence

 

i believe hownow is working through it just fine.

 

Hi Lee,

 

I had forgotten about those CFs from Michael which, in addition to be unlimited unlike repetitions, are not case sensitive.  Thank you for pointing it out!  My calc might be easier to replicate.

Link to comment
Share on other sites

But you DO know how to capture the final one; that was specified in message 6.

 

In many instances of computer terms for a sequence of things, the first item is 1, second is 2; etc.

 

(Though in some variations, the numbering starts at zero)

 

The LAST item is -1.

Second from last is -2.

Etc.

Link to comment
Share on other sites

As far as the other thread, here is the way I suggest you look at it.

First you find the position of some unique prefix that you know comes before the text you are looking for.

 

IF this prefix is found (its position is a number greater than zero) 

 

THEN

 

A. You want to start at the end of the prefix and find the position of the character that comes just before the text you want. In this case ( arrow 1) the ">" character.

 

B. You want to start at the end of the prefix and find the position of the next closing tag. Arrow 2 "</a>" 

 

Then you use the middle function to get the text between these points.

Between the position of the character at arrow 1 and the position of the tag at arrow 2.

 

END IF

post-62898-0-72577300-1421178013_thumb.p

post-62898-0-14845400-1421178517_thumb.p

Link to comment
Share on other sites

Another way of capturing the position of the text at arrow 1 is to get the position of the text at arrow 2 as previously described.

And use the "find first previous occurrence" approach.

Let's say that position is 483.

Then, since the third term of the Position function is "starting from where"

 

Position( $myText; ">"; 483, -1) would give you the result.

 

Note that the result is always counted from the head of the text.

So in this case it would be 461.

Link to comment
Share on other sites

This topic is 2878 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
 Share

×
×
  • Create New...

Important Information

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