Hi Robert,This makes no sense to me, see examples below.
set foundString to fnd("[\s]+", str, true, true, true) -->error
You need to escape the backslash,
set foundString to fnd("[\\s]+", str, true, true, true) will work (else AppleScript is looking for a special character \s, like \n or \"). set str to "Your Broadband2Go Account Number and Programming Instructions" -- set foundString to fnd("[A-Z0-9space]+", str, true, true, true) --> 15 - should be 18
In this case, " space" is just a collection of five characters, as you see in the result:
{"Y", "B", "a", "a", "2G", "Acc", "N", "e", "a", "P", "a", "I", "s", "c", "s"}
-- set foundString to fnd("[A-Z0-9]+", str, true, true, true) --> 7 - should be 9
The result is {"Y", "B", "2G", "A", "N", "P", "I"}, why would you expect 9?
-- set foundString to fnd("[[A-Z],[0-9]]+", str, true, true, true) --> 7 - should be 9
Again, the result is {"Y", "B", "2G", "A", "N", "P", "I"}. I'm not sure how double brackets are to be interpreted.
set foundString to fnd("[NA ]+", str, true, true, true) --> 6 - should be 18
This yields {" ", " A", " N", " ", " ", " "}. What did you expect?All the best Thomas |