[Mono-list] Regex dosen't recognize \s or \w ?

IBBoard ibboard at gmail.com
Wed Feb 4 18:55:51 UTC 2015


That'd cover "zero or more spaces", but wouldn't cover "zero or more
whitespace characters" (which is what "\s" would get you, and what I'm
assuming OP really wants, despite not *quite* being what they said in
their final quesion).

Do any escape characters work or is it just those? Don't forget that
regex escapes like \s are different to character escapes like \r, \n and
\t - you need to escape the backslash if you're using it in
double-quoted strings, or else it will be treated like a character
escape, not a special regex escape.

See the example at
https://msdn.microsoft.com/en-us/library/ms228595.aspx#code-snippet-2
for what I mean.



On 04/02/15 18:49, Agustin Gimenez wrote:
> Not sure if that's a bug or not, but you can perfectly use " *?" to
> search for zero or more spaces (I always try to use lazy search when
> possible, if that's not your case remove the question mark after star),
> I have put that inside quotes to denote the space before the star.
> 
> Cheers.
> 
> 2015-02-04 16:03 GMT+01:00 mickeyf <mickey at thesweetoasis.com
> <mailto:mickey at thesweetoasis.com>>:
> 
>     I am using Monodevelop 3.0.3.2,  with mono runtime 2.10.8.1 on
>     Ubuntu 12.04
> 
>     When I try to include \s or \w in my regex, I get 'Unrecognized escape
>     sequence', Otherwise regex works as I'd expect. (But I freely admit to
>     having limited experience with regex.)
> 
>     What have I missed? Or if \s is not available, how do I specify "zero or
>     more spaces" ?
> 
> 
> 
>     --
>     View this message in context:
>     http://mono.1490590.n4.nabble.com/Regex-dosen-t-recognize-s-or-w-tp4665410.html
>     Sent from the Mono - General mailing list archive at Nabble.com.
>     _______________________________________________
>     Mono-list maillist  -  Mono-list at lists.ximian.com
>     <mailto:Mono-list at lists.ximian.com>
>     http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 


More information about the Mono-list mailing list