It seems that an unmatched opening bracket makes it completely fail. My
guess is that the filter string is not valid so it doesn't even try. I
couldn't get a filter string containing a "[" to match anything.
On Wed, Jan 24, 2024 at 5:23 PM Craig Newman via use-livecode <
Brian.
So the inclusion of “[“ would have matched nothing in the original string
""aaa[bbb””? That is, even though the bracketed string was not “closed” with
“]”, did it try to find a string that began with “b”, failed, and therefore
returned the original string untouched?
Craig
> On Jan 24,
I just want to clarify that this isn’t the regex version of filter but the
wildcard pattern version. It is much less complicated than regex. Square
brackets are used to group characters to be matched so you can use [abc]* to
match any item that starts with a, b, or c. The dictionary entry
Thanks Brian of putting me right (once again) . I had completely forgotten.the
escape sequence for the wildcards is [*] and [? (an unexpected way to escape a
character, but it is what it is) and so had overlooked that [ is itself a
special character.
And neither * nor ? In the msg box example
Brian.
The original post tried to filter a string by filtering (without) that actual
string, and was interested in why that did not yield empty. Intuitively, the
result of such a filter operation ought always to be empty. The presence of the
char “[“ is the “culprit”. That is as far as I took
Your test misses the actual issue:
on mouseup
local tStr
local tFilter
put "a*b" into tFilter
put "anything bold" into tStr
filter tStr with tFilter
put tStr
end mouseup
Will yield "anything bold"
while using the following 2 lines:
put "a?b" into tFilter
put "a*b" into
OK, instead of working I did this:
on mouseUp
repeat with y = 1 to 255
put "XX" & numToChar(y) & "XX" into temp
filter temp without temp
if temp <> "" then put y & return after accum
end repeat
answer accum
end mouseUp
There are two characters that prevent the filter command from doing
Brian.
Nope. Those two chars pass through the filter, er, filtered.
Again, I did not test the entire character set.
Craig
> On Jan 24, 2024, at 11:05 AM, Brian Milby via use-livecode
> wrote:
>
> The only other two that would cause issues are ? and * which are single and
> multiple char
The only other two that would cause issues are ? and * which are single and
multiple char wildcards respectively.
Brian Milby
br...@milby7.com
> On Jan 24, 2024, at 10:21 AM, Craig Newman via use-livecode
> wrote:
>
> I did not test the ASCII set exhaustively, but the culprit is the char
I did not test the ASCII set exhaustively, but the culprit is the char “[“
(ASCII 91). Any other char (including “]”) in the string works correctly, that
is, nothing is left after the filter command executes.
I do not know enough to say whether that particular char does something to the
Not sure this is really a bug. The default is to match a wildcardPattern. If
you want to match [ then you must use [[] in the pattern.
Brian Milby
br...@milby7.com
> On Jan 23, 2024, at 9:02 PM, Neville Smythe via use-livecode
> wrote:
>
> Try this in the msg box:
>
> put "aaa[bbb" into
Try this in the msg box:
put "aaa[bbb" into tStr; put line 1 of tStr into tLine; filter tStr without
tLine; put tStr
I get (using MacOS, LC 9.6.11)
aaa[bbb
That is to say, the line is not filtered out.
And:
put "aaa[bbb" into tStr; filter tStr with tStr; put tStr
produces an empty string
12 matches
Mail list logo