HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/insiders/wp-load/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);
	}
}