Author Topic: Perl regex problem  (Read 388 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1679
  • Hero Points: 160
  • 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: 161
  • 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: 4539
  • Hero Points: 350
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: 195
  • Hero Points: 25
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: 4539
  • Hero Points: 350
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.