if you can not find a pattern then you have to do it character by character.
you could, in theory, convert the entire string to "N"'s, "L"'s and punctuation where N = any number character and L = any letter character then use position ( "NN-NNNNNN" ) then extract from the original text
If there are no other numbers in the rest of the text, you can Filter(originalText; "0123456789-")
What do you want if there are 2 or more found, or longer text like xxx-xxxxxxxxx ?
note the ifs in siplus and user 19752 responses?
For us to suggest an effective solution we need better understanding of the problem domain.
If the op can effectively define the PD then he/she might see the solution.
lead a horse to water and let it drink on its own
The text I'm extract varies from a couple hundred words to over 1000 words. Mixture of numbers, text, names, document numbers, dates, etc etc. So filtering specific characters is not an option.
I don't believe there will be more than one occurrence, and if there is it should be identical. However, there will be occurrences of the longer text like xxx-xxxxxxxxxxxx. In fact, the one pattern of xx-xxxxxx is only one of several patterns I need to extract. I was hoping to "master" extracting one then applying the process to the others.
My problem is that I'm working with variable text of variable length for which there are approximately 15 variable, but known, patterns (such as xx-xxxxx) that I want to extract.
Each variable, known sequence exists in only a percentage of the records.
The first sequence I asked about has space characters surrounding the text which I didn't mention before:
" xx-xxxxxx "
For me, it doesn't matter what other text exists before or after as long as I can extract this specific sequence from the records in which this sequence exists. This particular sequence only has numbers, but of the other 14 patterns I'm looking for, there will be a mixture. One of them has a pattern of " xxx-xx-Fxx " where x is numeric and "F" is the letter F.
Knowing how to extract multiple occurrences of this text would be helpful, but not necessary for this particular pattern.
coherentkris... did I give enough info? Without going line by line and searching each line for the pattern, I'm not sure what to do (is there such a thing?)
I see a problem when you have 12-123456 and 312-12345678 in the same text.
What you can do is to to replace the spaces in your text with ¶, producing a list, then go through the list with GetValue() and see if the element contains "-" and is longer than 1. If yes, add it to a second list.
I'm trying to connect the dots with what I know and for other things I'm working through, so please bear with me as I ask a different sort of question.
I know that I can bold the word " Document " in a record using a combination of substitute and text format functions.
Is there a way for me to tell Filemaker to bold a sequence of text " xx-xxxxxx " where the "x" is any alpha-numeric character?
I've been using custom functions. And, though I don't always understand the underlying programming, I have been able to figure out how to apply the function to what I need. Several I've been using regularly of late include ParseBetween, SubstituteRange, SubstituteWildcardRange, MagicDates, Trim4 and several others.
But, when I look at the CustomList() function you've directed me to, I have no idea what to do with it. How does it apply to finding " xx-xxxxxx " ?
1 of 1 people found this helpful
I suggested the CustomList() function as part of a solution as proposed by siplus: to convert your text field into a carriage return-delimited list, which you would either loop through via script or the CustomList() function to process each value.
However, as Korry suggests you might also want to look into a custom function that can perform regular expressions on the text, i.e. pattern matching.
If you ask 3 FileMaker developers how to do something, expect 10 different answers.
Thanks to all who helped decipher what I was trying to ask..
Korry and PeterDoern.... you've both pointed me in what appear to be good directions for what I need and am (will be) capable of doing with my present level of experience. Looks like I need to do some more reading up to see what will work best in the long haul for this particular need.
Regardless, both of you have directed me to resources I need and am interested in learning more about.