bugGNU Octave - Bugs: bug #45407, regexprep returns unescaped string...

 
 

bug #45407: regexprep returns unescaped string in ML but not Octave

Submitted by:  Richard <crobar>
Submitted on:  Thu 25 Jun 2015 02:52:44 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: WTF, Matlab?!?
Status: FixedAssigned to: None
Originator Name: Richard CrozierOpen/Closed: Closed
Release: 4.0.0Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Mon 29 Jun 2015 03:58:39 PM UTC, comment #10:

I changed this on the development branch in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/b6a59cc96bfa).

Rik <rik5>
Project Administrator
Mon 29 Jun 2015 03:14:15 PM UTC, comment #9:

No problem, answering the questions is a lot less work than coming up with them:

Richard <crobar>
Mon 29 Jun 2015 03:11:56 PM UTC, comment #8:

Sorry for so many questions, but I keep finding subtle points.

What does Matlab return for

Rik <rik5>
Project Administrator
Mon 29 Jun 2015 06:48:00 AM UTC, comment #7:

I get

Richard <crobar>
Mon 29 Jun 2015 03:22:43 AM UTC, 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.

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.

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?

Rik <rik5>
Project Administrator
Fri 26 Jun 2015 11:49:14 PM UTC, comment #5:
Richard <crobar>
Fri 26 Jun 2015 03:01:58 PM UTC, comment #4:

Hmm, this is starting to look like very esoteric Matlab behavior.

What does Matlab do for

Rik <rik5>
Project Administrator
Fri 26 Jun 2015 06:53:57 AM UTC, comment #3:

I take it you mean sprintf?

Richard <crobar>
Fri 26 Jun 2015 05:02:50 AM UTC, comment #2:

To simplify, what does Matlab return for the following

Rik <rik5>
Project Administrator
Thu 25 Jun 2015 02:58:49 PM UTC, comment #1:

Hmm, I meant:

In Octave:

Richard <crobar>
Thu 25 Jun 2015 02:52:44 PM UTC, original submission:

In Matlab when you pass an escaped string to regexprep, it is returned 'unescaped' but not in Octave, e.g.

in Octave:

in Matlab:

Richard <crobar>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by crobar (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 29 Jun 2015 03:58:39 PM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Mon 29 Jun 2015 03:22:43 AM UTCrik5Item GroupMatlab Compatibility=>WTF, Matlab?!?

    Back to the top


    Powered by Savane 3.1-cleanup1