• Home
    • English
    • 中文
  • About Us
  • Services
    • SEO Services
    • Website Design Service
  • Projects
  • Docs
  • Blog
    • Affiliate
    • Ecommerce
    • Frontend
    • linux
      • nginx
    • PHP
      • Magento
      • wordpress
    • Python
    • SEO
    • Web
  • Contact Us

Subscribe to Updates

Get the latest creative news from FooBar about art, design and business.

What's Hot

Design a plugin for wordpress woocommerce to display a tab to show attachment download

2024-04-06

TranslatePress v2.6.9 – WordPress Translation Plugin

2023-12-25

A Linux batch script converting pictures to webp format

2023-07-10
Facebook Twitter Instagram
  • 中文
  • English
Facebook Twitter Instagram Pinterest VKontakte
Weilai Tech Weilai Tech
  • Home
    • English
    • 中文
  • About Us
  • Services
    • SEO Services
    • Website Design Service
  • Projects
  • Docs
  • Blog
    • Affiliate
    • Ecommerce
    • Frontend
    • linux
      • nginx
    • PHP
      • Magento
      • wordpress
    • Python
    • SEO
    • Web
  • Contact Us
Weilai Tech Weilai Tech
Home»PHP»php7.3 pregmatch problem
PHP

php7.3 pregmatch problem

OxfordBy Oxford2021-04-26No Comments1 Min Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

This question already has an answer here:

  • preg_match(): Compilation failed: invalid range in character class at offset 4 answers
  • preg_match compilation failed: invalid range in character class [duplicate] 3 answers
  • PHP 7.3 update – preg Compilation failed [duplicate] 1 answer

I am using simple_html_dom.inc.php for url extractor. The codes are working normaly without problem. But i am getting the following Warning from PHP7.3

Warning: preg_match(): Compilation failed: invalid range in character class at offset 4 in 1387

You can see the error line in this link: Error Line 1387

if (!preg_match("/^[\w-:]+$/", $tag)) {
    $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
    if ($this->char==='<') {
        $this->link_nodes($node, false);
        return true;
    }
    if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
    $this->link_nodes($node, false);
    $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
    return true;
}

Do you have a solution for this problem? Thanks in advance.

</div>


Answer:

PHP 7.3 upgraded from PCRE to PCRE2. Which is much more strict on regular expressions. For example, you need to escape - between square brackets. And this is the problem in you regex.

Changing it to /^[\w\-:]+$/ should solve your problem.

 

Source from

https://ask.csdn.net/questions/948561

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Avatar photo
Oxford

Related Posts

how to Set up a multisite via Drupal8?

2021-06-25

Drupal theme development

2021-06-17

Using WP Super Cache with IIS 7

2021-05-01

Use the Windows Cache Extension for PHP

2021-05-01
Recent Posts
  • Design a plugin for wordpress woocommerce to display a tab to show attachment download
  • TranslatePress v2.6.9 – WordPress Translation Plugin
  • A Linux batch script converting pictures to webp format
  • Hearing aid listed company official website SEO case
  • how to use docker to run php5.6 plus apache
April 2021
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930  
« Mar   May »
Tags
app branding design digital Docly docs etc faq fix github Helpdesk Image issue magento Manual marketing memecached Photography planing seo sequrity tips Travel ui/ux web WordPress 爬虫
Editors Picks
About Us

Guangzhou Weilai Technology is a foreign trade integrated marketing service provider focusing on Google as the drainage center and marketing self-built website as the carrier.

Email Us: [email protected]
Contact: +86 18676917505

Facebook Pinterest YouTube LinkedIn
Recent Posts
  • Design a plugin for wordpress woocommerce to display a tab to show attachment download
  • TranslatePress v2.6.9 – WordPress Translation Plugin
  • A Linux batch script converting pictures to webp format
  • Hearing aid listed company official website SEO case
  • how to use docker to run php5.6 plus apache
From Flickr
Website Design Case
© 2024 Copyright by Guangzhou Weilai Technology Co.,Ltd..
  • Home
  • About Us
  • SEO Services
  • Website Design Service
  • Projects
  • Blog
  • Contact Us

Type above and press Enter to search. Press Esc to cancel.