Reference - PAD functions - matches


App: manual - Page: fragments/conditions_6
PHP
fragments/conditions_6.php
HTML
fragments/conditions_6.pad
Result
<?php

$count
= 3;
$heading = '';
$code = 'NL1234';
$state = 'pending';

?>
<p>{$count} {echo $count eq 1 ? 'item' : 'items'}</p>
<p>Title: {$heading | ?? 'Untitled'} - subtitle: {echo $subtitle ?? 'none'}</p>
<p>Code {$code} {if $code matches '/^[A-Z][A-Z][0-9]+$/'}is{else}is not{/if} well formed</p>
<p>State {$state} {if $state in ('active', 'pending')}is open{else}is closed{/if}</p>


App: manual - Page: fragments/expressions_25


App: regression/errors - Page: eval/matches_needs_a_regular_expression
PHP
HTML
eval/matches_needs_a_regular_expression.pad
Result
{echo 'x' | matches('/(/')}


App: regression/framework - Page: expressions/a_not_between_a_value_and_its_test_denies_the_test
PHP
HTML
expressions/a_not_between_a_value_and_its_test_denies_the_test.pad
Result
{data 'rows'}[{"s":"a"},{"s":"b"},{"s":"c"}]{/data}{rows where='$s not in ("a", "b")'}{$s}{/rows}|{rows where='$s not like "a%"'}{$s}{/rows}|{if 5 not in (5, 6)}T{else}F{/if}|{rows}{if $s ne 'a' and $s not in ('b')}{$s}{/if}{/rows}|{rows}{if $s not matches '/^[ab]$/'}{$s}{/if}{/rows}|{if 5 not range (1, 4)}T{else}F{/if}|{if not 5 in (1)}T{else}F{/if}


App: regression/framework - Page: expressions/matches_tests_a_regular_expression
PHP
expressions/matches_tests_a_regular_expression.php
HTML
expressions/matches_tests_a_regular_expression.pad
Result
<?php $x = "aaa"; $n = 5; $empty = ""; $zero = 0; ?>
[{if $x matches '/^a+$/'}yes{else}no{/if}][{echo 'x.y' | matches('/x\\.y/')}][{echo 'xzy' | matches('/x\\.y/')}]


App: regression/framework - Page: lenient/a_list_handed_to_a_pipe_function_as_its_parameter_is_empty
PHP
lenient/a_list_handed_to_a_pipe_function_as_its_parameter_is_empty.php
HTML
lenient/a_list_handed_to_a_pipe_function_as_its_parameter_is_empty.pad
Result
<?php

// The lenient walk: a list where a pipe function wants a value as its parameter is empty.

$padCheckSyntax = FALSE;

?>
1[{echo 'abc' | contains(['a'])}] 2[{echo 'abc' like ['a']}] 3[{echo 'abc' | matches(['a'])}] 4[{echo 'abc' | after(['a'])}] 5[{echo 'abc' | left([1])}] 6[{echo 'abc' | truncate([2])}] 7[{echo 'abc' | escape(['js'])}] 8[{echo 'b' | between(['a'], 'z')}]