help with replacetext

Jim Ault JimAultWins at yahoo.com
Sat Jun 30 13:36:54 CDT 2007


I did my first answer without the "right before the suffix" part

\d  means digit
[^\d] means non-digit
[^\d\n\.] means non-digit, not linefeed and not period

Using replaceText makes the task a bit difficult but here is a solution that
works:
--need to setup a condition where digits not followed by a period can be
located, then purge them
--  "[\d]+q"  says locate runs of digits followed by a "q"

  put replaceText( tolower(tFiles5),"[^\d\n\.]","q") into tFiles6
  put replaceText( tFiles6,"[\d]+q", empty) into tFiles6
  replace "q" with empty in tFiles6
  replace "." with empty in tFiles6
  filter tFiles6 without empty

or (matchChunk /or/ matchText) repeat loop to grab the positive matches for
digit-followed-by-period strings


Jim Ault
Las Vegas

On 6/30/07 5:43 AM, "Klaus Major" <klaus at major-k.de> wrote:

> Hi friends,
> 
> I am making tiny baby steps with regex stuff but need your help here :-)
> 
> I have a list of files like:
> 
> image one-01.png
> imag22.jpg
> i225.png
> image crop-22.jpg
> imag.tiff
> imageimage3 bb.jp
> ...
> 
> And need a list of JPG and PNG files and all numbers that are located
> right before the suffix.
> So from the above example it should return:
> 
> 01
> 22
> 22
> 225
> ...
> 
> You get the picture.
> 
> I already filtered all jpg and png files from the list, then I use
> e.g. :
> ...
> put replacetext(tolower(tFiles5),"[a-zA-Z]","") into tFiles6
> ...
> 
> but don't know how to add ALL non-numeric chars to the syntax.
> 





More information about the use-livecode mailing list