These aren't the characters you're looking for...

Robin Barker Robin.Barker at npl.co.uk
Tue Aug 19 11:17:01 BST 2008


From: Andy Wardley
> I mistakenly wrote this the other day:
>
>     [\s^\n]
>
> What I wanted was to match a whitespace character that wasn't a newline.
>
> Of course, I could just write this:
>
>     [ \t]
>
> But that doesn't include the Unicode whitespace characters which \s would
> normally match.  So I ended up writing this:
>
>     [ \t\x{85}\x{2028}\x{2029}]
>
> Second: am I missing something obvious?  Is there a better way to do it?

You could use 
	[[:blank:]] 
(see perlre), but my experience is that [:...:] does not behave as I expect with unicode (maybe my expectations are wrong).

You could also do a negative look ahead 
	(?!\n)\s

Robin

-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Serco House, 16 Bartley Wood Business Park,
                   Hook, Hampshire, United Kingdom  RG27 9UY
-------------------------------------------------------------------



More information about the london.pm mailing list