Author Topic: Perl regex problem  (Read 1951 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Perl regex problem
« on: May 16, 2018, 06:59:14 PM »
I found regex pat1 doesn't match case 2, but does match case 1.
pat2 matches case2 but not case3.

https://regex101.com shows it should match both.
Python re also matches.

Code: [Select]
pat1: "([0-9]*?)(18)"
pat2" "([0-9]{3,4})(18)"
case1: "4918 116"
case2: "514918 116"
case3: "51918 116"

rgloden

  • Senior Community Member
  • Posts: 169
  • Hero Points: 5
Re: Perl regex problem
« Reply #1 on: June 01, 2018, 04:19:10 PM »
pat1 should also have matched case3.

As a learning experience, I tried this in the RegEx Eval tool.

Other patterns which seem to fail to return the expected:
([0-9]{1,5})(18)
([0-9]{2,5})(18)
([0-9]{1,4})(18)

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Perl regex problem
« Reply #2 on: June 01, 2018, 04:50:46 PM »
This will be fixed in v23.

TKasparek

  • Senior Community Member
  • Posts: 246
  • Hero Points: 29
Re: Perl regex problem
« Reply #3 on: June 06, 2018, 02:52:23 PM »
Clark, can you provide some insight as to what the issue is? I use regex a lot and am surprised I seen this before. It worries me a little that something basic like these would miss; makes me wonder if I've missed things I should have addressed in my past searches...

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Perl regex problem
« Reply #4 on: June 06, 2018, 02:55:11 PM »
The problem is with errors in optimization code

No logic errors.