February 7, 20241 yr How could I extract the first continuous string from the right in a text field? The string can contain letters, numbers, as well as special characters such as "-", or "_", or ".". Therefore RightWords or MiddleWords fails/returns incomplete results Here's an example: -rwxrwxrwx 7 998 1001 244678656 Jan 26 19:11 HBS5_Prototype-DragDropV2.fmp12 What I'm looking to extract is "HBS5_Prototype-DragDropV2.fmp12" The content to the left is variable, as is the string to be extracted. What is constant is the " " space (and the fact that within the string there are NO spaces). Here are some more examples: -rwxrwxrwx 1 998 1001 4308992 Feb 5 21:00 HBS5_QualityControl_IC.fmp12 -rwxrwxrwx 7 998 1001 63971328 Jan 30 21:00 DriveTo_Help_Coordination.fmp12 -rwxrwxrwx 2 998 1001 14118912 Feb 1 20:28 int_BlogManager.fmp12 I would need something that goes from the right to the first space, but I'm not sure how to construct that? Any help greatly appreciated.
February 7, 20241 yr 20 minutes ago, innodat said: What is constant is the " " space (and the fact that within the string there are NO spaces) That's good. So what you want to do is find the position of the last space in the given text, and then either remove everything up to that mark: Let ( lastSpace = Position ( text ; " " ; Length ( text ) ; -1 ) ; Replace ( text ; 1 ; lastSpace, "" ) ) or extract the part after it: Let ( [ len = Length ( text ) ; lastSpace = Position ( text ; " " ; len ; -1 ) ] ; Right ( text ; len - lastSpace ) ) Edited February 7, 20241 yr by comment
Create an account or sign in to comment