My function is changing $word_one
(je/que je in j'/que j'), if $word_two
begins with a vowel.
function FrenchCompoundTenses($word_one, $word_two) {
if(preg_match('~(.*)\bje$~ui', $word_one, $m) && preg_match('~^[aeéiou]~ui>', $word_two))
return "<td class=\"text-right text-muted\">{$m[1]}j'</td>" . $word_two;
else
return "<td class=\"text-right text-muted\">". $word_one ."</td>" . $word_two;
}
For a similar function I have to change this part:
&& preg_match('~^[aeéiou]~ui>', $word_two)
It should worked, if $word_two
begin with HTML code <u>
or </td><td>
and then a vowel is following.([aeéiou]
)
EDIT: $word_one
comes from an array with pronoun and $word_two
comes from a 2-dimensional array. $word_two
are in this case two words.
example:
$word_one= 'je' + $word_two='aime' = j'aime
$word_one= 'tu' + $word_two='aimes' = tu aimes
desired output with this function:
$word_one= 'je' + $word_two='<u>aime' = j'aime (with html code between)
$word_one= 'je' + $word_two='</td><td>aime' = j'aime (with html code between)
&& preg_match('~^h?(?:[aæàâeéèêëiîïoôœuûù]|y(?![aæàâeéèêëiîïoôœuûù]))~ui', strip_tags($word_two))
should solve the problem.(I added an optional
h
at the begining sinceh
is a silenth
in french. I added too several accented vowels) and they
when not followed by another vowel.