bugGNU Octave - Bugs: bug #62705, Some regex patterns are...

 
 

bug #62705: Some regex patterns are incorrectly treated as named expressions

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Mon 04 Jul 2022 07:31:01 PM UTC
 
Category:  Octave Function Severity:  1 - Wish
Priority:  1 - Later Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Tue 05 Jul 2022 06:22:47 PM UTC, comment #4: 

Lowering the Priority even further to "Later".  We don't really need to take this up unless Matlab changes their behavior.

Rik <rik5>
Project Administrator
Tue 05 Jul 2022 12:39:18 PM UTC, comment #3: 

Thanks for checking. Maybe they struggle with the same issues that we do.
I checked on https://regex101.com/. IIUC, the last example should theoretically match.
But it is comforting to know that at least we are a bit more compatible in that respect now.

Lowering the priority since - although regular expressions of that type aren't matched correctly - they aren't in Matlab either (at least as of now)...

Markus Mützel <mmuetzel>
Project Member
Tue 05 Jul 2022 11:55:57 AM UTC, comment #2: 

I tested in Matlab online and the three first examples return 1, and the last one returns empty "[]" in Matlab as it now does Octave. So at least the current behavior is fully ML compatible for the 4 examples provided.

Pantxo Diribarne <pantxo>
Project Member
Mon 04 Jul 2022 07:43:01 PM UTC, comment #1: 

I pushed a patch that fixes this for the first three examples here:
https://hg.savannah.gnu.org/hgweb/octave/rev/7d3bda173b63

The last pattern is more difficult to detect as not a named pattern. I'm not sure if it is worth the additional complexity...

Leaving this open in case someone would like to work on this.

Markus Mützel <mmuetzel>
Project Member
Mon 04 Jul 2022 07:31:01 PM UTC, original submission:  

The following patterns are incorrectly classified as named expressions by Octave. Named expressions are transformed to PCRE syntax. This leads to the (incorrectly classified) patterns to not match where they should:

regexpi ('<', '\(?<')
regexpi ('<n>', '\(?<n\>')
regexpi ('<n>', '\(?<n\>\)?')
regexpi ('<n>a', '\(?<n\>a\)?')

IIUC, all of these should return `1`. But they return `[]` (or crash or emit an error before the fix for bug #62704).

I have a fix for some of those ready that I'll push when I have a bug number.

Markus Mützel <mmuetzel>
Project Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by mmuetzel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-05 rik5 Priority3 - Low 1 - Later
    2022-07-05 mmuetzel Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
        StatusNone Confirmed

    Back to the top


    Powered by Savane 3.9