[H-GEN] regular expressions

Martin Pool mbp at linuxcare.com.au
Mon Aug 21 22:11:56 EDT 2000


On Tue, Aug 22, 2000 at 11:55:29AM +1000, Jason Henry Parker wrote:
> $ echo 'I don\'t think I\'m wrong'
> > 
> 
> (I'd often like to write something like:
> 
> $ perl -e'open FILH, "</etc/passwd" or die "Can't open /etc/passwd:
> $!\n"'

It's not impossible, just annoying:

  echo 'It'\''s a beautiful day in Canberra'

Speaking of which, Python has the ultra-handing "raw string" quoting
style which is especially good for regular expressions:

  print r"Look Mum, \no \\doubled backslashes: here's a newline: \n"

(Yes, I know Perl has even more ways to do this.  But this is more
like the smallest necessary syntax.)

-- 
Martin Pool, Linuxcare, Inc.
+61 2 6262 8990
mbp at linuxcare.com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20000822/cec6044e/attachment.sig>


More information about the General mailing list