Thanks
On Thu, 29 Nov 2018 08:37:42 +0000, Epperlein, Lutz (agendo) via 4D_Tech wrote: > Peter answered already, but if you want to test your regex, you can > use e.g.: > https://regexr.com/440e2 > this is with Kirk's example. > > You regex looks there: > https://regexr.com/440ee > > This is a nice tool which provides explanations for your regex too. > > Regards Lutz > > >> -----Original Message----- >> From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Chip >> Scheide via >> 4D_Tech >> Sent: Wednesday, November 28, 2018 7:29 PM >> To: 4D iNug Technical <4d_tech@lists.4d.com> >> Cc: Chip Scheide <4d_o...@pghrepository.org> >> Subject: Re: [off-ish] Regex help >> >> Thanks Kirk, >> >> That will be useful, but mostly I am wondering based on what (very >> tiny) understanding I have of Regex why the previously posted statement >> does not do what your loop does. >> >> According to Wiki : >> . - matches any single character >> ( ) - defines a marked subexpression >> * - matches the preceding element zero or more times >> so... as I read the definitions... >> "(.*:)" >> >> match any character(s), before a ":" >> a file path (on a Mac) is <folder> : <folder> : <folder> ... : <file> >> >> Match Regex says: >> "...If you pass arrays, the command returns the position and length of >> the occurrence in the element zero of the arrays and the positions and >> lengths of the groups captured by the regular expression in the >> following elements." >> >> so I would expect(ed) >> Match regex($folderPathMotif;$File_Path;1;$path_pos;$path_len) >> >> to populate the arrays with each occurrence of ":", as your supplied >> code appears to do, >> OR >> if the Match Regex does not find/report all occurrences of ":" to >> report the FIRST instance of a ":", not the last. >> >> Thanks >> again >> Chip >> >> On Wed, 28 Nov 2018 10:16:01 -0800, Kirk Brooks via 4D_Tech wrote: >>> Chip, >>> >>> I think what you want is to parse the path into its component parts. >>> >>> This this pattern for matching: >>> >>> ([ \w\d-_]+): >>> >>> This will match letters, numbers, spaces, underscores and dashes up to the >>> semi colon. You will want to use it in a loop like so: >>> >>> $pattern:="([ \\w\\d-_]+):" >>> $start:=1 >>> While(Match regex($patters;$text;$start;$aPos;$aLen)) // pass arrays for >>> pos and len >>> >>> // $aLen[0] will be the length of the entire match >>> >>> // $aLen[1] will be the length of the match within the parens >>> >>> APPEND TO ARRAY($aTheParts;Substring($text;$aPos{1};$aLen{1}) >>> >>> $start:=$aPos{0}+$aLen{0} // move up to the next match >>> >>> End while >>> >>> >>> On Wed, Nov 28, 2018 at 9:51 AM Chip Scheide via 4D_Tech < >>> 4d_tech@lists.4d.com> wrote: >>> >>>> can anyone who has a clue help me? >>>> >>>> I am looking at some code: >>>> Match regex($folderPathMotif;$File_Path;1;$path_pos;$path_len) >>>> >>>> where: >>>> ARRAY LONGINT($path_pos;0) >>>> ARRAY LONGINT($path_len;0) >>>> $folderPathMotif:="(.*:)" >>>> and >>>> File_Path is, well.., a file path on a Mac (so folder separator is ":") >>>> >>>> When the above regex runs, $Path_pos and $path_len each have 1 element, >>>> and that element is a reference to the LAST occurrence of ":" in the >>>> file path. >>>> >>>> Why does the regex not populate the arrays with the location of ALL >>>> occurrences of ":", or the first occurrence of ":"? >>>> >>>> Thanks for any help... >>>> and off Nug help is fine >>>> --------------- >>>> Gas is for washing parts >>>> Alcohol is for drinkin' >>>> Nitromethane is for racing >>>> >> ********************************************************************* >> * >>>> 4D Internet Users Group (4D iNUG) >>>> Archive: http://lists.4d.com/archives.html >>>> Options: https://lists.4d.com/mailman/options/4d_tech >>>> Unsub: mailto:4d_tech-unsubscr...@lists.4d.com >>>> >> ********************************************************************* >> * >>> >>> >>> >>> -- >>> Kirk Brooks >>> San Francisco, CA >>> ======================= >>> >>> *We go vote - they go home* >>> >> ********************************************************************* >> * >>> 4D Internet Users Group (4D iNUG) >>> Archive: http://lists.4d.com/archives.html >>> Options: https://lists.4d.com/mailman/options/4d_tech >>> Unsub: mailto:4d_tech-unsubscr...@lists.4d.com >>> >> ********************************************************************* >> * >> --------------- >> Gas is for washing parts >> Alcohol is for drinkin' >> Nitromethane is for racing >> ********************************************************************* >> * >> 4D Internet Users Group (4D iNUG) >> Archive: http://lists.4d.com/archives.html >> Options: https://lists.4d.com/mailman/options/4d_tech >> Unsub: mailto:4d_tech-unsubscr...@lists.4d.com >> ********************************************************************* >> * > ********************************************************************** > 4D Internet Users Group (4D iNUG) > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ********************************************************************** --------------- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************