summaryrefslogtreecommitdiff
blob: dcb0142d16b323e05ff8093db46f2a7bb33c291b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
declare( strict_types = 1 );

namespace MediaWiki\Extension\Translate\Validation\Validators;

// phpcs:disable Generic.Files.LineLength.TooLong
/**
 * An insertable IOS variable validator.
 * See: https://github.com/dcordero/Rubustrings/blob/61d477bffbb318ca3ffed9c2afc49ec301931d93/lib/rubustrings/action.rb#L91
 * @author Abijeet Patro
 * @license GPL-2.0-or-later
 * @since 2020.03
 */
class IosVariableValidator extends InsertableRegexValidator {
	public function __construct() {
		parent::__construct(
			 "/%(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|\'[^$])?" .
			 "(-)?(\d+)?(?:\.(\d+))?(hh|ll|[hlLzjt])?([b-fiosuxX@])/"
		);
	}
}