My cms system (flynax.com) uses smarty template engine.
I have template that prints field value from database.
Tag used in template to print description field value (html) is:
{$item.value}
I need to hide any phone number from description field, and to do that I need to find any phone number in field output and replace it with this code:
<span class='telefon' data-last='REPLACED_VALUE'><span class='telefon2'>{$lang.click_here_to_show}</span></span>
I have jquery code that will be used to hide any phone number and show it on click (I also than track clicks with google analytics).
{literal}
<script>
$(document).ready(function() {
$('.telefon').toggle(function() {
$(this).find('span').text({/literal}'{$lang.click_here_to_show}'{literal});
}, function() {
$(this).find('span').text($(this).data('last'));
}).click();
});
</script>
{/literal}
Code that I am trying and which trows me errors is:
{$item.value|regex_replace:"/([+]{0,1}[\d]{1,5}[\s]{0,1}[\/]{0,1}[(]{0,1}[\d]{0,3}[)]{0,1}\s{0,1}\d{2,4}[-]{0,1}[\s]{0,1}[\d]{2,4}[-]{0,1}[\s]{0,1}[\d]{1,4})$/gm":"<span class='telefon' data-last='$1'><span class='telefon2'>{$lang.click_here_to_show}</span></span>"}
test of my regex: check here
Can you suggest what I am doing wrong?
Thanks.