-2

Updated php of my application to 7.3 but now most of the preg_match are showing: preg_match_all(): Compilation failed: invalid range in character class at offset 23.

I did read that it is a escape problem but somehow i can't get it right.

URL to the regex https://regex101.com/r/JCSyJp/2/

Trying to escape - and \ chars but nothing is working.

Some one please help me out.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Mitch Daniels
  • 33
  • 1
  • 7

1 Answers1

1

Put the hyphen at the beginning or at the end of character class:

(?:^(?<host>[\w-]+\.[\w.-]*?)\.\s*(?<ttl>\d+)\s*(?<wtf>\w*)\s*(?<rectype>\w*)\s*(?<value>.*)\s*$)
Toto
  • 89,455
  • 62
  • 89
  • 125