home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!wupost!darwin.sura.net!uvaarpa!mmdf
- From: Dov Grobgeld <dov@menora.weizmann.ac.il>
- Subject: Regular expression bug?
- Message-ID: <1992Sep13.200457.5806@uvaarpa.Virginia.EDU>
- Sender: mmdf@uvaarpa.Virginia.EDU (Mail System)
- Reply-To: dov@menora.weizmann.ac.il
- Organization: The Internet
- Date: Sun, 13 Sep 1992 20:04:57 GMT
- Lines: 61
-
- I didn't get any replies last time. Perhaps I wasn't clear enough. So
- I'll try again.
-
- I would like to match a string of the following format:
-
- <n>H<n bytes>
-
- where n is a a number in ASCII. Examples of such strings are:
-
- 6Horange
- 0H
- 16Hthis\nis\na string
-
- I tried matching them with the following regular expression:
-
- /(\d+)H([\000-\377]{\1})/ && print "string= ($2)\n";
-
- but it didn't work. The following did work though:
-
- if (s/(\d+)H//) {
- s/([\000-\377]{$1})//;
- print "string= ($1)\n";
- }
-
- It seems like you can't give \1,\2,...,\9 inside braces in the same
- regular expression. I guess I can live without it. It just means that
- I can't use the m//g construct in order to match such strings...
- Larry (are you listening?), can this be fixed?
-
- By the way, it is quite ugly to have to write [\000-\377] in order to
- say "any character". What about providing a hook for redefining "." to
- include "\n"?
-
- This reminds me of the "\b" construct, which is quite crippled when working
- with character sets other than English, since it is impossible in Perl to
- redefine what is a letter and what is a white-space. E.g. in Swedish
- "ASCII" standard the characters "}", "{", "|" and some others are
- used as letters.
-
- Certainly the problems won't go away when Perl is ported for Unicode...
- What about providing such hooks already now?
-
- --
- ___ ___
- / o \ o \
- Dov Grobgeld ( o o ) o |
- The Weizmann Institute of Science, Israel \ o /o o /
- "Where the tree of wisdom carries oranges" | | | |
- _| |_ _| |_
-
-
-
-
- --
- ___ ___
- / o \ o \
- Dov Grobgeld ( o o ) o |
- The Weizmann Institute of Science, Israel \ o /o o /
- "Where the tree of wisdom carries oranges" | | | |
- _| |_ _| |_
-
-