• 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: RegEx question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RegEx question


  • Subject: Re: RegEx question
  • From: Wim Melis <email@hidden>
  • Date: Fri, 20 Feb 2004 01:49:57 +0100

Thanks Emmanuel - yes, that should do the trick.

I forgot about the (grouping) trick that solves it. Should've seen that
one, especially since I used that exact method when replacing
ampersands... be it that grouping wasn't necessary there. I personally
prefer to use legible replacements, they don't have to be single chars.
Something like LESSDUMMY and GREATERDUMMY for instance, I find it easier
to debug the code this way.

As for XML: haven't got a clue about it... Making that a somewhat less
practical solution for my needs :-)

Wim

>>I'd like to build a regular expression search (using Satimage osax) that
>>finds all greater-than en less-than characters that are NOT part of a
>>matching pair of HTML tags, and replace then with the appropriate html
>>codes.

>Maybe you can do that with regular expressions, but be aware that they
>were not designed for that kind of job. It should be more a job for some
>XML library, I wonder if Late Night Software's XML Tools and/or XSLT Tools
>can something for you?

>Decide for two characters a and b that should not be in the text (I
>recommend ASCII character of 1 and ASCII character of 4). Then:
>
>------------ untested
>set s to change "<([^<>]+)>" into (a & "\\1" & b) in s with regexp
>set s to change {"<", ">"} into {"&lt;", "&gt;"} in s
>set s to change {a, b} into {"<", ">"} in s
>-- I suppose you could group the two last instructions into one
>--------------------
>
> Emmanuel



-----
email (home): email@hidden
email (office): email@hidden
http://www.noorderlicht.com * Noorderlicht photofestival
_______________________________________________
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: Panther bug: 'missing value' for modification date??
  • Next by Date: Re: 'store script' 2 times => busy!?
  • Previous by thread: Re: RegEx question
  • Next by thread: Panther bug: Perl 'tr/\\0-\\xFF//CU' no longer works!?
  • Index(es):
    • Date
    • Thread