filter with a tab character
Thierry Douez
th.douez at gmail.com
Mon Feb 4 13:07:40 EST 2013
2013/2/4 FlexibleLearning.com <admin at flexiblelearning.com>
> I have tab-delimited list and am trying to filter lines.
>
> Q1. How do we include a TAB character in the expression? Using filter with
> "*\tsomeText" fails.
>
see \s below
>
> Q2. How do we specify a maximum numeric value? Using filter with "*[<18]"
> fails.
>
on mouseUp
local tmp
put fld 1 into tList
-- \s match space and tab
-- get "\s[0-9]\s" -- any 0 to 9 single number
-- get "\s[1-4][0-9]\s" -- accept 10 to 49
-- get "\s[1-4]\d\s" -- accept 10 to 49
-- get "\s[1-4]?\d\s" -- accept 0 to 49
get "\s[1-4]?(\d){1,3}\s" -- accept 0 to 4999
repeat for each line L in tList
if matchText( L, IT ) then put L &cr after tmp
end repeat
put tmp
end mouseUp
Forget about filter; it doesn't play with regex, just sort of...
my fld test contains:
hjkdf sdfsdflkj 987 dsf sdf sdf
fgffg gf gf 4998 fd ddf ddfd
fgffg gf gf 5000 fd ddf ddfd
ere e re eeee1234567890eeeeeeeee
gfgjfkgf dfglwer 0 fdfsla sdfsdf
gfgjfkgf dfglwer 42 fdfsla sdfsdf
try tytry retert 41 dfsdffdsd
sdflk; asdf 33 dfdfdfsa dsfsdff
kjklj jlkjlk 7 ljlkj lkjkjlkj jljljkl
And it's fast.
HTH,
Thierry
More information about the use-livecode
mailing list