HEX
Server: LiteSpeed
System: Linux cluster02.load-balancer.x2.network 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64
User: kbdhpghp (1098)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /home/kbdhpghp/vivenciarteatelie.com.br/wp-content/plugins/internal-links/helper/regex.php
<?php
namespace ILJ\Helper;

/**
 * Regex toolset
 *
 * Methods for regex operations
 *
 * @package ILJ\Helper
 * @since   1.2.0
 */
class Regex {

	/**
	 * Validates if a regex pattern is valid
	 *
	 * @since  1.2.0
	 * @param  string $pattern The regular expression
	 * @return bool
	 */
	public static function isValid($pattern) {
		if (preg_match('/' . $pattern . '/', '') === false) {
			return false;
		}
		return true;
	}

	/**
	 * Escapes the dot character in a text
	 *
	 * @since 1.2.0
	 * @param string $text Text that gets escaped
	 *
	 * @return string
	 */
	public static function escapeDot($text) {
		 return str_replace('.', '\.', $text);
	}
}