Re: regexp
Re: regexp
- Subject: Re: regexp
- From: Emmanuel <email@hidden>
- Date: Wed, 7 Sep 2005 09:39:42 +0200
At 6:50 PM -0600 9/6/05, Robert Poland wrote:
set w to window 2 -- a text window
set bounds of w to {0, 44, 588, 517} -- this line works
change {"^[[:space:]]+", "[[:space:]]+$"} into {"", ""} in w with regexp
gives me the error"Can't make {"^[[:space:]]+",[[:space:]]+$"}into
type string"
Probably a bad advice you got from the Smile Discussion List. They
don't know, but "change" accepts lists only when applied to an
AppleScript variable, not to a window.
What am I doing wrong?
Nothing. Just write two lines instead of one:
change "^[[:space:]]+" into "" in w with regexp
change "[[:space:]]+$" into "" in w with regexp
What is the function of the colons?
The brackets mean: inside I'm defining a class of characters. One
special class is named as [:space:], it means all the kinds of
"space" (space, tab, return, linefeed, maybe non-breaking space also,
I don't know). For instance to match any space or a vowel, you would
search the following regular expression:
[aeiou[:space:]]
What form would text take in the find area?
Same thing without the quotes. About the find area in Smile, note
that the menu close to "regular expression" is really a short manual
to regular expressions.
I would appreciate an example of replacing "this" with "that".
change "this" into "that" in "this train"
Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >regexp (From: Robert Poland <email@hidden>) |