• 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
RegEx ignores space in pattern
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RegEx ignores space in pattern


  • Subject: RegEx ignores space in pattern
  • From: Hans Haesler <email@hidden>
  • Date: Fri, 19 Mar 2004 17:46:22 +0100

I'd like to match numbers which can be formatted like this:
12 34 56-78
123 456-78
1234 56-78

Using "RegEx Commands" this works fine:
---
set aString to "abc 12 34 56-78 def"
set testString to REMatch aString pattern "[0-9][0-9 ]+-[0-9][0-9]"
-->"12 34 56-78"

But... the text contains other numbers, which shouldn't be matched:
---
set aString to "abc12-34-567def"
set testString to REMatch aString pattern "[0-9][0-9 ]+-[0-9][0-9]"
-->"12-34"

I tried this with "Satimage", too. With the same result.

Why is the space in the second range of characters ignored?
Can someone confirm this problem? Or, hopefully, show me a workaround...

TIA,
Hans

---
Hans Haesler <email@hidden>
_______________________________________________
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.


  • Follow-Ups:
    • Re: RegEx ignores space in pattern
      • From: Emmanuel <email@hidden>
    • Re: RegEx ignores space in pattern
      • From: "John W. Baxter" <email@hidden>
  • Prev by Date: Re: Hat bug.
  • Next by Date: Re: RegEx ignores space in pattern
  • Previous by thread: Re: Initializing variables
  • Next by thread: Re: RegEx ignores space in pattern
  • Index(es):
    • Date
    • Thread