octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #45407] regexprep returns unescaped string in


From: Rik
Subject: [Octave-bug-tracker] [bug #45407] regexprep returns unescaped string in ML but not Octave
Date: Mon, 29 Jun 2015 03:22:44 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0

Update of bug #45407 (project octave):

              Item Group:    Matlab Compatibility => WTF, Matlab?!?         

    _______________________________________________________

Follow-up Comment #6:

This seems to be buggy Matlab behavior.  Escape sequences are not processed in
ordinary single-quoted strings.  Okay, that is the same as Octave.


'x\.y'
ans = x\.y


In places where a single-quoted string does undergo escape processing, such as
the format string for the *printf family of functions, Matlab does strict
validation and warns when an escape sequence is invalid.  Okay, that is also
the same as Octave.


x = sprintf ('x\.y')
warning: unrecognized escape sequence '\.' -- converting to '.'


So only in the replacement string of regexprep are escape sequences simply
converted the the character that follows the backslash?  *Sigh*.

I changed the Item Group to 'WTF Matlab!?!'.  I can change this in Octave, but
it screws up strsplit.m which then needs recoding.  Just to be certain, what
do these return?


regexprep ('s', '(s)', '\\$1')
regexprep ('s', '(s)', '\\\\$1')




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45407>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]