• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Satimage re_compile regex functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Satimage re_compile regex functions


  • Subject: Re: Satimage re_compile regex functions
  • From: has <email@hidden>
  • Date: Sat, 27 Apr 2002 22:32:36 +0100

Luc Naets wrote:

>Where can I find some documentation on the implementation of the regex
>function within satimage on 're_compile' and 'find text regexp true'.
>
>I know very well how to do it with Leonard Rosenthol's regex-osax, but
>nothing seems to work with re_compile
>
>an expression like re_compile "^A\\d+ (\\d+)" gives an error. What is the
>correct syntax for such a thing in satimage. How do you do it !

Syntax, as well as feature set, varies from implementation to
implementation. You'll find information on the syntax in Smile's Find
dialog:

--------------

^ beginning of a line
$ end of a line
\< beginning of a word
\> end of a word
\b beginning or end of a word
\B within a word
. any character
[] character class, ex. [abc]
- range, ex. [a-zA-Z0-9]
^ negated class, ex. [^@]
\ escapes special characters
\w word character
\W non-word character
\r carriage return
\t tab
* zero or more occurences
+ one or more occurences
? zero or one occurrence
{i,j} i to j occurences
{i,} i or more occurences
{i} i occurences
| or
() group
\1, \2
references to groups
[:alnum:] letters and digits
[:alpha:] letters
[:lower:] lowercase letters
[:upper:] uppercase letters
[:digit:] digits
[:xdigit:] hexa digits
[:blank:] space or tab
[:space:] space, tab, CR, LF, FF
[:cntrl:] codes < 32 or 127
[:punct:] neither control nor alphanumeric

--------------

You should be able to find plenty of general info about regex via a web
search. (If you find a really good one, let us all know.)


One thing I didn't realise until Emmanuel pointed it out to me; use (eg):

"[[:digit:]]"

not:

"[:digit:]"

So your pattern would be:

"^A[[:digit:]]+ ([[:digit:]]+)"


One other thing about re_compile - I've found this to be unreliable (OMM?)
with more complex patterns (unfortunate, since this is where it'd be most
useful). I'm on v1.8.4, however; maybe it's been fixed since?


Cheers,

has

--
http://www.barple.connectfree.co.uk/ -- The Little Page of Beta AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Exponential notation [was: Re: How to calculate/process this one?]
  • Next by Date: Finder can't walk and chew gum
  • Previous by thread: Re: Satimage re_compile regex functions
  • Next by thread: Re: Satimage re_compile regex functions
  • Index(es):
    • Date
    • Thread