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.

Find all text to the left of a certain digit ?

Featured Replies

Hello

If I have repeated sentences in my field "sentence" Like

Jeremy uses the 4 stage solution.

Phil and Brenda decided to make use of the 7 stage procedure.

David and Joe always use the 3 stage plan.

I am trying to figure out how to text calculate removing everything before the digit "stage" in each sentence. ( each sentence will always have a digit and stage in it. ) and placing that text only in a field called "opening"

In the above examples the text I am speaking about is in bold and I would like to have a formula to automate putting that bold text in a field called "opening"

I need help with this one. and thanks to you.

Much appreciated,

Dave [color:"red"]

  • Author

I need to amend something in the question I asked.

I have a further complication. digit "stage" is used in most sentences but sometimes I have to do the same thing I have described but it changes to "Part" digit.

A sentence in this case would be.

Denny always decided to go with part 4.

Cathy made all here quotes based on part 2.

So I am asking how to put everything before digit "stage" or "part " digit into a field called "opening"

Thanks for your patience.

Dave

Hi,

You're basically extracting each string from the x position of your break - the position of the Word at left of your break...

In this case, I'd use ???

- a global field (g_Break) populated by either "Stage" or "Part",

- a counter (g_counter) from which you'd stop the loop when g_counter = Patterncount(t_Sentance,g_Break)

Set it to Null at script beginning-

- Pass the content of your Sentance to a global field (g_ToParse)

- Loop with a script that :

1. Set the counter to the next value with SetField[g_counter, g_counter+1)]

2. Extract from g_ToParse the 1st string breaking at the end of the 1st occurrence of g_Break

SetField[g_Extract = Middle(g_ToParse,1,Position(g_ToParse, g_Break,1,1)+Length(g_Break)

3. Set another global g_StringParsed with

SetField[g_StringParsed,Middle(g_Extract ,1,Position(g_Extract ,MiddleWords(g_Extract ,WordCount(Middle(g_Extract ,1,Position(g_Extract ,g_Break,1,1)-1))-1,1),1,1)+Lenght(MiddleWords(g_Extract ,WordCount(Middle(g_Extract ,1,Position(g_Extract ,g_Break,1,1)-1))-1,1)))]

4.Set the content of your new Text Field with SetField[t_NewText,t_NewText&"

Actually, you could simplify it by extracting each string directly from your Original Sentance, inolving the counter to limit the extraction to the x occurrence of your g_Break.

I shouldn't post when I don't have the time to... crazy.gif

  • Author

I just made a discovery trying to get it to work.

It is always the left part of the sentence before whatever I have extracted in the field "type"

"type" = "part" or "type" = "stage"

Since that is already extracted in a script -I need to get the words that show up in a sentence before or to the left of whatever the contents of field "type" is in the field "wholeSentence" which contains the original sentence. I am not quite sure how to do this . But this is what I have to do which may be somewhat easier.

Thanks

DAve

The problem is deciding what you are going to use to define the end of each sentence. Ugo's solution is to use the text "stage" or "part" as the break. What happens when the text you want to extract contains either of these words ?

I think ( based on the info provided ) I would use the carriage return as my end of line break. Therefore here is my script ???-

Set Field G_LineCount = PatternCount(Sentence,"

Well, if either "stage" or "break" can show up and you want to parse all what is before each string, and ignore what is after the separator until the next "."

then a simplfied version would be to use the Substitute function.

SetField[g_Parsed, "ENDSENTANCE"&Substitute(Substitute(Substitute(t_OriginalSentance, "stage","BREAKHERE"),"part","BREAKHERE"),".","ENDSENTANCE")

>>ENDSENTANCEPhil and Brenda decided to make use of the 7 BREAKHERE procedureENDSENTANCE

David and Joe always use the 3 BREAKHERE planENDSENTANCE

So now, logically, the script will extract each string one by one, comprised from the Position of x occurrence of "ENDSENTANCE" to the Position of x occurrence of "BREAKHERE" - 1 Word.

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.