Re: applescript-users digest, Vol 2 #1169 - 15 msgs
Re: applescript-users digest, Vol 2 #1169 - 15 msgs
- Subject: Re: applescript-users digest, Vol 2 #1169 - 15 msgs
- From: has <email@hidden>
- Date: Mon, 8 Oct 2001 12:21:11 +0100
>
Date: Sun, 07 Oct 2001 12:57:41 -0400
>
Subject: Regular Expressions Resources
>
From: Greg Back <email@hidden>
>
To: AppleScript Mailing List <email@hidden>
>
>
Hi-
>
>
I was just wondering if there are there any good resources on the web for
>
regular expressions commands? After seeing this kind of stuff on the list, I
>
can only imagine the true power of them:
>
>
>REReplace names pattern "(.+) ([0-9]+)\\.jpg" with "\\2.jpg \\1"
Heh, I think I remember that one.:)
>
But I have no Idea what any of it means?
Regular expressions are great for complex text manipulations. They take a
little getting used to, but can be incredibly powerful. They also require a
good manual to explain them.:) Certain characters and character
combinations have special meanings in Regular Expressions (these may vary a
bit between different OSAXen/applications), so a reference guide is
essential.
My own preference is for Leonard Rosenthol's RegEx Commands -
http://www.lazerware.com/software.html - which also comes with very good
documentation. I'd recommend that as a good starting point.
>
I currently have the Regular Expressions OSAX from Script Tools 1.3.6, but
>
am willing to look at others if they are better. Also, would BBEdit work for
>
this sort of thing?
>
>
Background:
>
I am trying to create a droplet that will make all HTML tags in a document
>
lowercase. i.e. <HTML> becomes <html> (among other things). If anyone knows
>
of any resources (scripts, apps) to do this I would be very appreciative,
In RegEx Commands:
REReplace theHTML pattern "<[^>]*>" with "\\l&"
First, this identifies html tags (matches a given pattern) by looking for
"<[^>]*>", which represents any html tag:
"<" = start of html tag
"[^>]" = any character except ">" (close of html tag)
"*" = matches zero or more instances of the preceding character (in this
case "[^>]")
">" = close of html tag
Then, for every piece of matched text, it replaces it with "\\l&", which is
the same text but in lowercase:
"\\l" = lowercase the following text
"&" = include the originally matched text here
Sorted.<g>
>
but I still want to learn about Regular Expressions, if only for the
>
educational value.
If working with text is your thing, then go for it...:)
HTH
has